Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

22.0.8 doesn't support extending config from another workspace #3084

Open
bryanjtc opened this issue Dec 2, 2023 · 13 comments
Open

22.0.8 doesn't support extending config from another workspace #3084

bryanjtc opened this issue Dec 2, 2023 · 13 comments

Comments

@bryanjtc
Copy link

bryanjtc commented Dec 2, 2023

Current behavior

A new dependency was added to resolve an issue with windows paths in 22.0.8, import-from-esm. Now I have an error if I extend from a local config or a local package from another workspace.

Expected behavior

No error

semantic-release version

22.0.8

CI environment

Gitlab

Plugins used

No response

semantic-release configuration

CONFIG 1

/* eslint-disable import/no-extraneous-dependencies */
const { readFile } = require('fs');
const { join } = require('path');
const { promisify } = require('util');
const { gitmojis } = require('gitmojis');

/**
 * Read async file.
 */
const readFileAsync = promisify(readFile);

/**
 * Read template.
 */
const template = readFileAsync(join(__dirname, 'default-template.hbs'));
/**
 * Read commit template.
 */
const commitTemplate = readFileAsync(join(__dirname, 'commit-template.hbs'));

module.exports = {
  branches: ['dev'],
  plugins: [
    [
      require.resolve('semantic-release-gitmoji'),
      {
        releaseRules: {
          major: gitmojis.filter(({ semver }) => semver === 'major').map(({ code }) => code),
          minor: gitmojis.filter(({ semver }) => semver === 'minor').map(({ code }) => code),
          patch: gitmojis.filter(({ semver }) => semver === 'patch').map(({ code }) => code),
        },
        releaseNotes: {
          template,
          partials: { commitTemplate },
          helpers: {
            /**
             * Helper to group commits.
             * @param commits Commits.
             * @param options Helper options.
             * @returns Grouped commits.
             */
            groupCommits(commits, options) {
              /**
               * Get all commits.
               */
              const allCommits = Object.values(commits).flat();
              /**
               * Grouped commits.
               */
              let groupedCommits = {};

              allCommits
                .filter((commit) => commit !== undefined)
                .forEach((commit) => {
                  const gitmoji = gitmojis.find(
                    ({ emoji }) => emoji.localeCompare(commit.gitmoji) === 0,
                  );

                  if (gitmoji === undefined) {
                    return;
                  }

                  groupedCommits = {
                    ...groupedCommits,
                    [gitmoji.semver]: [...(groupedCommits[gitmoji.semver] || []), commit],
                  };
                });

              return options.fn(groupedCommits);
            },
          },
        },
      },
    ],
    require.resolve('@semantic-release/changelog'),
    [
      require.resolve('@semantic-release/exec'),
      {
        prepareCmd:
          // eslint-disable-next-line no-template-curly-in-string
          "yarn version ${nextRelease.version} && echo '::set-output name=version::${nextRelease.version}'",
        publishCmd: 'yarn npm publish --access public',
      },
    ],
    require.resolve('@tech-ayudinga/semantic-release-gitlab-cjs'),
    [
      require.resolve('@semantic-release/git'),
      {
        message:
          // eslint-disable-next-line no-template-curly-in-string
          '🚀 RELEASE: chore(release) - ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
      },
    ],
  ],
};

CONFIG 2: Extends from config 1

{
  "branches": ["{feature,bug,chore}/*", "dev"],
  "extends": ["@tech-ayudinga/semantic-release"]
}

CI logs

Screenshot_20231201-223443_Brave

@sheerlox
Copy link
Member

sheerlox commented Dec 2, 2023

Hi, I'm the author of the related PR and the underlying import-from-esm package, I'll try to help you as best as possible to debug that issue.

I have not used monorepos in years, and I am not aware of the inner workings of multi-semantic-release either. I would appreciate it if you could provide a minimal reproduction example I could use to debug the issue.

In the meantime, you could also try to run the release process with DEBUG=import-from-esm, as the package contains a few lines of debugging logs that would help to make a first assessment of the situation.

@brummelte
Copy link

brummelte commented Jan 24, 2024

@sheerlox

❯ DEBUG=import-from-esm yarn semantic-release
[3:40:45 PM] [semantic-release] › ℹ  Running semantic-release version 22.0.8
(node:4486) [MODULE_NOT_FOUND] Error: debug tried to access supports-color (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.
(Use `node --trace-warnings ...` to show where the warning was created)
  import-from-esm Executing importFrom('/mnt/c/projects/current-repository/.yarn/cache/semantic-release-npm-22.0.8-d7a4b93b5a-5e82076661.zip/node_modules/semantic-release/lib', 'my-repository-with-release-config') +0ms
  import-from-esm 'my-repository-with-release-config' is not a file module +0ms
  import-from-esm Trying to resolve 'my-repository-with-release-config' from 'file:///mnt/c/projects/current-repository/.yarn/cache/semantic-release-npm-22.0.8-d7a4b93b5a-5e82076661.zip/node_modules/semantic-release/lib/noop.js' +1ms
  import-from-esm Failed to resolve 'my-repository-with-release-config' from 'file:///mnt/c/projects/current-repository/.yarn/cache/semantic-release-npm-22.0.8-d7a4b93b5a-5e82076661.zip/node_modules/semantic-release/lib/noop.js': Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'my-repository-with-release-config' imported from /mnt/c/projects/current-repository/.yarn/cache/semantic-release-npm-22.0.8-d7a4b93b5a-5e82076661.zip/node_modules/semantic-release/lib/noop.js +2ms
  import-from-esm Trying to resolve 'my-repository-with-release-config.js' from 'file:///mnt/c/projects/current-repository/.yarn/cache/semantic-release-npm-22.0.8-d7a4b93b5a-5e82076661.zip/node_modules/semantic-release/lib/noop.js' +0ms
  import-from-esm Failed to resolve 'my-repository-with-release-config.js' from 'file:///mnt/c/projects/current-repository/.yarn/cache/semantic-release-npm-22.0.8-d7a4b93b5a-5e82076661.zip/node_modules/semantic-release/lib/noop.js': Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'my-repository-with-release-config.js' imported from /mnt/c/projects/current-repository/.yarn/cache/semantic-release-npm-22.0.8-d7a4b93b5a-5e82076661.zip/node_modules/semantic-release/lib/noop.js +1ms
  import-from-esm Trying to resolve 'my-repository-with-release-config.mjs' from 'file:///mnt/c/projects/current-repository/.yarn/cache/semantic-release-npm-22.0.8-d7a4b93b5a-5e82076661.zip/node_modules/semantic-release/lib/noop.js' +1ms
  import-from-esm Failed to resolve 'my-repository-with-release-config.mjs' from 'file:///mnt/c/projects/current-repository/.yarn/cache/semantic-release-npm-22.0.8-d7a4b93b5a-5e82076661.zip/node_modules/semantic-release/lib/noop.js': Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'my-repository-with-release-config.mjs' imported from /mnt/c/projects/current-repository/.yarn/cache/semantic-release-npm-22.0.8-d7a4b93b5a-5e82076661.zip/node_modules/semantic-release/lib/noop.js +1ms
  import-from-esm Trying to resolve 'my-repository-with-release-config.cjs' from 'file:///mnt/c/projects/current-repository/.yarn/cache/semantic-release-npm-22.0.8-d7a4b93b5a-5e82076661.zip/node_modules/semantic-release/lib/noop.js' +0ms
  import-from-esm Failed to resolve 'my-repository-with-release-config.cjs' from 'file:///mnt/c/projects/current-repository/.yarn/cache/semantic-release-npm-22.0.8-d7a4b93b5a-5e82076661.zip/node_modules/semantic-release/lib/noop.js': Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'my-repository-with-release-config.cjs' imported from /mnt/c/projects/current-repository/.yarn/cache/semantic-release-npm-22.0.8-d7a4b93b5a-5e82076661.zip/node_modules/semantic-release/lib/noop.js +1ms
  import-from-esm Trying to resolve 'my-repository-with-release-config.json' from 'file:///mnt/c/projects/current-repository/.yarn/cache/semantic-release-npm-22.0.8-d7a4b93b5a-5e82076661.zip/node_modules/semantic-release/lib/noop.js' +0ms
  import-from-esm Failed to resolve 'my-repository-with-release-config.json' from 'file:///mnt/c/projects/current-repository/.yarn/cache/semantic-release-npm-22.0.8-d7a4b93b5a-5e82076661.zip/node_modules/semantic-release/lib/noop.js': Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'my-repository-with-release-config.json' imported from /mnt/c/projects/current-repository/.yarn/cache/semantic-release-npm-22.0.8-d7a4b93b5a-5e82076661.zip/node_modules/semantic-release/lib/noop.js +2ms
  import-from-esm Cannot find module 'my-repository-with-release-config' +0ms
  import-from-esm Executing importFrom('/mnt/c/projects/current-repository', 'my-repository-with-release-config') +0ms
  import-from-esm 'my-repository-with-release-config' is not a file module +0ms
  import-from-esm Trying to resolve 'my-repository-with-release-config' from 'file:///mnt/c/projects/current-repository/noop.js' +0ms
  import-from-esm Failed to resolve 'my-repository-with-release-config' from 'file:///mnt/c/projects/current-repository/noop.js': Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'my-repository-with-release-config' imported from /mnt/c/projects/current-repository/noop.js +1ms
  import-from-esm Trying to resolve 'my-repository-with-release-config.js' from 'file:///mnt/c/projects/current-repository/noop.js' +1ms
  import-from-esm Failed to resolve 'my-repository-with-release-config.js' from 'file:///mnt/c/projects/current-repository/noop.js': Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'my-repository-with-release-config.js' imported from /mnt/c/projects/current-repository/noop.js +0ms
  import-from-esm Trying to resolve 'my-repository-with-release-config.mjs' from 'file:///mnt/c/projects/current-repository/noop.js' +1ms
  import-from-esm Failed to resolve 'my-repository-with-release-config.mjs' from 'file:///mnt/c/projects/current-repository/noop.js': Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'my-repository-with-release-config.mjs' imported from /mnt/c/projects/current-repository/noop.js +1ms
  import-from-esm Trying to resolve 'my-repository-with-release-config.cjs' from 'file:///mnt/c/projects/current-repository/noop.js' +0ms
  import-from-esm Failed to resolve 'my-repository-with-release-config.cjs' from 'file:///mnt/c/projects/current-repository/noop.js': Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'my-repository-with-release-config.cjs' imported from /mnt/c/projects/current-repository/noop.js +0ms
  import-from-esm Trying to resolve 'my-repository-with-release-config.json' from 'file:///mnt/c/projects/current-repository/noop.js' +1ms
  import-from-esm Failed to resolve 'my-repository-with-release-config.json' from 'file:///mnt/c/projects/current-repository/noop.js': Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'my-repository-with-release-config.json' imported from /mnt/c/projects/current-repository/noop.js +0ms
  import-from-esm Cannot find module 'my-repository-with-release-config' +0ms
[3:40:45 PM] [semantic-release] › ✘  An error occurred while running semantic-release: Error: Cannot find module 'my-repository-with-release-config'
    at importFrom (file:///mnt/c/projects/current-repository/.yarn/cache/import-from-esm-npm-1.3.3-4c64f297d5-3f30a7bcce.zip/node_modules/import-from-esm/index.js:100:17)
    at async file:///mnt/c/projects/current-repository/.yarn/cache/semantic-release-npm-22.0.8-d7a4b93b5a-5e82076661.zip/node_modules/semantic-release/lib/get-config.js:36:85
    at async default (file:///mnt/c/projects/current-repository/.yarn/cache/semantic-release-npm-22.0.8-d7a4b93b5a-5e82076661.zip/node_modules/semantic-release/lib/get-config.js:34:11)
    at async Module.default (file:///mnt/c/projects/current-repository/.yarn/cache/semantic-release-npm-22.0.8-d7a4b93b5a-5e82076661.zip/node_modules/semantic-release/index.js:271:34)
    at async default (file:///mnt/c/projects/current-repository/.yarn/cache/semantic-release-npm-22.0.8-d7a4b93b5a-5e82076661.zip/node_modules/semantic-release/cli.js:55:5) {
  code: 'MODULE_NOT_FOUND'
}
Error: Cannot find module 'my-repository-with-release-config'
    at importFrom (file:///mnt/c/projects/current-repository/.yarn/cache/import-from-esm-npm-1.3.3-4c64f297d5-3f30a7bcce.zip/node_modules/import-from-esm/index.js:100:17)
    at async file:///mnt/c/projects/current-repository/.yarn/cache/semantic-release-npm-22.0.8-d7a4b93b5a-5e82076661.zip/node_modules/semantic-release/lib/get-config.js:36:85
    at async default (file:///mnt/c/projects/current-repository/.yarn/cache/semantic-release-npm-22.0.8-d7a4b93b5a-5e82076661.zip/node_modules/semantic-release/lib/get-config.js:34:11)
    at async Module.default (file:///mnt/c/projects/current-repository/.yarn/cache/semantic-release-npm-22.0.8-d7a4b93b5a-5e82076661.zip/node_modules/semantic-release/index.js:271:34)
    at async default (file:///mnt/c/projects/current-repository/.yarn/cache/semantic-release-npm-22.0.8-d7a4b93b5a-5e82076661.zip/node_modules/semantic-release/cli.js:55:5) {
  code: 'MODULE_NOT_FOUND'
}%

@sheerlox
Copy link
Member

@brummelte please provide more information about your setup. Your issue doesn't seem related to this one at first glance.

@brummelte
Copy link

brummelte commented Jan 24, 2024

semantic release 22.0.7 works, 22.0.8 doesn't.

Using yarn with

pnpFallbackMode: all
pnpMode: loose

release.config.js

module.exports = {
    extends: "my-repository-with-release-config",
};

The package is in my package.json.

For me this seems to be the same issue, just that I don't use multi-semantic-release. So should be even easier to reproduce.

@sheerlox
Copy link
Member

Hey @bryanjtc, @brummelte.

Sorry for the delay, having very little free time lately.

Could you please provide a minimum reproduction repository so I can look into these issues further?

That would be really appreciated. Thanks in advance!

@francoisauclair911
Copy link

@sheerlox jumping in
this is a minimum reproduction repository : https://github.com/francoisauclair911/semantic-extend-repro
Step to reproduce
cd playground/
npx semantic-release

error log

[12:16:07 p.m.] [semantic-release] › ✘  An error occurred while running semantic-release: Error: Cannot find module '@adranetwork/semantic-release-preset'
    at importFrom (file:///Users/some-user/Code/changelog-playground/playground/node_modules/import-from-esm/index.js:100:17)
    at async file:///Users/some-user/Code/changelog-playground/playground/node_modules/semantic-release/lib/get-config.js:36:85
    at async default (file:///Users/some-user/Code/changelog-playground/playground/node_modules/semantic-release/lib/get-config.js:34:11)
    at async Module.default (file:///Users/some-user/Code/changelog-playground/playground/node_modules/semantic-release/index.js:274:34)
    at async default (file:///Users/some-user/Code/changelog-playground/playground/node_modules/semantic-release/cli.js:55:5) {
  code: 'MODULE_NOT_FOUND'
}
Error: Cannot find module '@adranetwork/semantic-release-preset'
    at importFrom (file:///Users/some-user/Code/changelog-playground/playground/node_modules/import-from-esm/index.js:100:17)
    at async file:///Users/some-user/Code/changelog-playground/playground/node_modules/semantic-release/lib/get-config.js:36:85
    at async default (file:///Users/some-user/Code/changelog-playground/playground/node_modules/semantic-release/lib/get-config.js:34:11)
    at async Module.default (file:///Users/some-user/Code/changelog-playground/playground/node_modules/semantic-release/index.js:274:34)
    at async default (file:///Users/some-user/Code/changelog-playground/playground/node_modules/semantic-release/cli.js:55:5) {
  code: 'MODULE_NOT_FOUND'
}%```

@sheerlox
Copy link
Member

@francoisauclair911 thank you for providing that, I'll do my best to free some time in the next 48h hours to see what I can do!

@sheerlox
Copy link
Member

@francoisauclair911 your problem is not related to this issue, which is specifically about yarn workspaces.

Your issue is that the top-level package.json declares @adranetwork/semantic-release-preset as a module, however, the content of .releaserc.js is CommonJS.

To resolve your issue, you should either convert your config to ESM, or change the extension to .cjs and update the main field of your package.json.

The error can be seen with DEBUG=import-from=esm, but since it should be more explicit about it without the debug flag, I've opened an issue to track this. Thanks for reporting.

@bryanjtc
Copy link
Author

bryanjtc commented Feb 15, 2024

@sheerlox Sorry for the delayed response. The error came from a private monorepo, so I couldn't share the code. I have another public monorepo where I found the same error. The log error came from a dry run in a github action.

Run unset GITHUB_ACTIONS && DEBUG=import-from-esm yarn workspaces foreach -W --no-private --topological-dev run semantic-release --dry-run --no-ci --branches ${HEAD_REF} -e semantic-release-monorepo
[11:11:42 PM] [semantic-release]    Running semantic-release version 23.0.2
2024-02-15T23:11:42.260Z import-from-esm Executing importFrom('/home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/semantic-release-npm-23.0.2-e417c507cf-a0d1ff971f.zip/node_modules/semantic-release/lib', 'semantic-release-monorepo')
2024-02-15T23:11:42.260Z import-from-esm 'semantic-release-monorepo' is not a file module
2024-02-15T23:11:42.260Z import-from-esm Trying to resolve 'semantic-release-monorepo' from 'file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/semantic-release-npm-23.0.2-e417c507cf-a0d1ff971f.zip/node_modules/semantic-release/lib/noop.js'
2024-02-15T23:11:42.262Z import-from-esm Failed to resolve 'semantic-release-monorepo' from 'file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/semantic-release-npm-23.0.2-e417c507cf-a0d1ff971f.zip/node_modules/semantic-release/lib/noop.js': Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'semantic-release-monorepo' imported from /home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/semantic-release-npm-23.0.2-e417c507cf-a0d1ff971f.zip/node_modules/semantic-release/lib/noop.js
2024-02-15T23:11:42.262Z import-from-esm Trying to resolve 'semantic-release-monorepo.js' from 'file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/semantic-release-npm-23.0.2-e417c507cf-a0d1ff971f.zip/node_modules/semantic-release/lib/noop.js'
2024-02-15T23:11:42.263Z import-from-esm Failed to resolve 'semantic-release-monorepo.js' from 'file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/semantic-release-npm-23.0.2-e417c507cf-a0d1ff971f.zip/node_modules/semantic-release/lib/noop.js': Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'semantic-release-monorepo.js' imported from /home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/semantic-release-npm-23.0.2-e417c507cf-a0d1ff971f.zip/node_modules/semantic-release/lib/noop.js
2024-02-15T23:11:42.263Z import-from-esm Trying to resolve 'semantic-release-monorepo.mjs' from 'file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/semantic-release-npm-23.0.2-e417c507cf-a0d1ff971f.zip/node_modules/semantic-release/lib/noop.js'
2024-02-15T23:11:42.263Z import-from-esm Failed to resolve 'semantic-release-monorepo.mjs' from 'file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/semantic-release-npm-23.0.2-e417c507cf-a0d1ff971f.zip/node_modules/semantic-release/lib/noop.js': Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'semantic-release-monorepo.mjs' imported from /home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/semantic-release-npm-23.0.2-e417c507cf-a0d1ff971f.zip/node_modules/semantic-release/lib/noop.js
2024-02-15T23:11:42.263Z import-from-esm Trying to resolve 'semantic-release-monorepo.cjs' from 'file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/semantic-release-npm-23.0.2-e417c507cf-a0d1ff971f.zip/node_modules/semantic-release/lib/noop.js'
2024-02-15T23:11:42.264Z import-from-esm Failed to resolve 'semantic-release-monorepo.cjs' from 'file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/semantic-release-npm-23.0.2-e417c507cf-a0d1ff971f.zip/node_modules/semantic-release/lib/noop.js': Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'semantic-release-monorepo.cjs' imported from /home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/semantic-release-npm-23.0.2-e417c507cf-a0d1ff971f.zip/node_modules/semantic-release/lib/noop.js
2024-02-15T23:11:42.264Z import-from-esm Trying to resolve 'semantic-release-monorepo.json' from 'file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/semantic-release-npm-23.0.2-e417c507cf-a0d1ff971f.zip/node_modules/semantic-release/lib/noop.js'
2024-02-15T23:11:42.265Z import-from-esm Failed to resolve 'semantic-release-monorepo.json' from 'file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/semantic-release-npm-23.0.2-e417c507cf-a0d1ff971f.zip/node_modules/semantic-release/lib/noop.js': Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'semantic-release-monorepo.json' imported from /home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/semantic-release-npm-23.0.2-e417c507cf-a0d1ff971f.zip/node_modules/semantic-release/lib/noop.js
2024-02-15T23:11:42.265Z import-from-esm Cannot find module 'semantic-release-monorepo'
2024-02-15T23:11:42.265Z import-from-esm Executing importFrom('/home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/packages/postcss-colorguard', 'semantic-release-monorepo')
2024-02-15T23:11:42.265Z import-from-esm 'semantic-release-monorepo' is not a file module
2024-02-15T23:11:42.265Z import-from-esm Trying to resolve 'semantic-release-monorepo' from 'file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/packages/postcss-colorguard/noop.js'
2024-02-15T23:11:42.266Z import-from-esm Failed to resolve 'semantic-release-monorepo' from 'file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/packages/postcss-colorguard/noop.js': Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'semantic-release-monorepo' imported from /home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/packages/postcss-colorguard/noop.js
2024-02-15T23:11:42.266Z import-from-esm Trying to resolve 'semantic-release-monorepo.js' from 'file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/packages/postcss-colorguard/noop.js'
2024-02-15T23:11:42.266Z import-from-esm Failed to resolve 'semantic-release-monorepo.js' from 'file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/packages/postcss-colorguard/noop.js': Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'semantic-release-monorepo.js' imported from /home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/packages/postcss-colorguard/noop.js
2024-02-15T23:11:42.266Z import-from-esm Trying to resolve 'semantic-release-monorepo.mjs' from 'file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/packages/postcss-colorguard/noop.js'
2024-02-15T23:11:42.267Z import-from-esm Failed to resolve 'semantic-release-monorepo.mjs' from 'file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/packages/postcss-colorguard/noop.js': Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'semantic-release-monorepo.mjs' imported from /home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/packages/postcss-colorguard/noop.js
2024-02-15T23:11:42.267Z import-from-esm Trying to resolve 'semantic-release-monorepo.cjs' from 'file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/packages/postcss-colorguard/noop.js'
2024-02-15T23:11:42.267Z import-from-esm Failed to resolve 'semantic-release-monorepo.cjs' from 'file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/packages/postcss-colorguard/noop.js': Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'semantic-release-monorepo.cjs' imported from /home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/packages/postcss-colorguard/noop.js
2024-02-15T23:11:42.267Z import-from-esm Trying to resolve 'semantic-release-monorepo.json' from 'file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/packages/postcss-colorguard/noop.js'
2024-02-15T23:11:42.26[8](https://github.com/bryanjtc/css-colorguard-upgraded/actions/runs/7923512677/job/21633373875?pr=278#step:7:9)Z import-from-esm Failed to resolve 'semantic-release-monorepo.json' from 'file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/packages/postcss-colorguard/noop.js': Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'semantic-release-monorepo.json' imported from /home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/packages/postcss-colorguard/noop.js
2024-02-15T23:11:42.268Z import-from-esm Cannot find module 'semantic-release-monorepo'
[11:11:42 PM] [semantic-release]    An error occurred while running semantic-release: Error: Cannot find module 'semantic-release-monorepo'
    at importFrom (file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/import-from-esm-npm-1.3.3-4c64f2[9](https://github.com/bryanjtc/css-colorguard-upgraded/actions/runs/7923512677/job/21633373875?pr=278#step:7:10)7d5-3f30a7bcce.zip/node_modules/import-from-esm/index.js:[10](https://github.com/bryanjtc/css-colorguard-upgraded/actions/runs/7923512677/job/21633373875?pr=278#step:7:11)0:17)
    at async file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/semantic-release-npm-23.0.2-e417c507cf-a0d1ff971f.zip/node_modules/semantic-release/lib/get-config.js:36:85
    at async default (file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/semantic-release-npm-23.0.2-e417c507cf-a0d1ff971f.zip/node_modules/semantic-release/lib/get-config.js:34:[11](https://github.com/bryanjtc/css-colorguard-upgraded/actions/runs/7923512677/job/21633373875?pr=278#step:7:12))
    at async Module.default (file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/semantic-release-npm-23.0.2-e4[17](https://github.com/bryanjtc/css-colorguard-upgraded/actions/runs/7923512677/job/21633373875?pr=278#step:7:18)c507cf-a0d1ff971f.zip/node_modules/semantic-release/index.js:274:34)
    at async default (file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/semantic-release-npm-[23](https://github.com/bryanjtc/css-colorguard-upgraded/actions/runs/7923512677/job/21633373875?pr=278#step:7:24).0.2-e417c507cf-a0d1ff971f.zip/node_modules/semantic-release/cli.js:55:5) {
  code: 'MODULE_NOT_FOUND'
}
Error: Cannot find module 'semantic-release-monorepo'
    at importFrom (file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/import-from-esm-npm-1.3.3-4c64f297d5-3f30a7bcce.zip/node_modules/import-from-esm/index.js:100:17)
    at async file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/semantic-release-npm-23.0.2-e417c507cf-a0d1ff971f.zip/node_modules/semantic-release/lib/get-config.js:36:85
    at async default (file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/semantic-release-npm-23.0.2-e417c507cf-a0d1ff971f.zip/node_modules/semantic-release/lib/get-config.js:34:11)
    at async Module.default (file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/semantic-release-npm-23.0.2-e417c507cf-a0d1ff971f.zip/node_modules/semantic-release/index.js:[27](https://github.com/bryanjtc/css-colorguard-upgraded/actions/runs/7923512677/job/21633373875?pr=278#step:7:28)4:[34](https://github.com/bryanjtc/css-colorguard-upgraded/actions/runs/7923512677/job/21633373875?pr=278#step:7:35))
    at async default (file:///home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/cache/semantic-release-npm-23.0.2-e[41](https://github.com/bryanjtc/css-colorguard-upgraded/actions/runs/7923512677/job/21633373875?pr=278#step:7:42)7c507cf-a0d1ff971f.zip/node_modules/semantic-release/cli.js:55:5) {
  code: 'MODULE_NOT_FOUND'
The command failed for workspaces that are depended upon by other workspaces; can't satisfy the dependency graph
Failed with errors in 1s [50](https://github.com/bryanjtc/css-colorguard-upgraded/actions/runs/7923512677/job/21633373875?pr=278#step:7:51)9ms
Error: Process completed with exit code 1.

Here is the branch of the monorepo that has the latest semantic-release version and an esm config file.
https://github.com/bryanjtc/css-colorguard-upgraded/tree/upgrade-to-esm

@brummelte
Copy link

My error was with just using yarn and not in a monorepo. Maybe it is a different problem, but the logs don't say anything relevant.

@sheerlox
Copy link
Member

sheerlox commented Mar 7, 2024

Thanks for providing a way for me to reproduce the error @bryanjtc, I'll try my best to tackle this issue in the coming weeks.

@brummelte I don't think the issue is with semantic-release-monorepo, probably because of yarn workspaces. I already tackled a similar issue end of December: sheerlox/import-from-esm#80.

I'll dig deeper when I get the chance!

@brummelte
Copy link

brummelte commented Mar 7, 2024

I'm neither using semantic-release-monorepo, nor yarn workspaces, nor esm in the project that is not working anymore. Just yarn pnp and a shared semantic release config with common js.

Maybe it's already fixed in the issue you mentioned, the version (https://github.com/sheerlox/import-from-esm/releases/tag/v1.4.0-alpha.1) is just not used yet.

@wolfgangwalther
Copy link

wolfgangwalther commented Apr 22, 2024

Just yarn pnp

Same here.

Correction: I am using yarn pnp + yarn workspaces.

Maybe it's already fixed in the issue you mentioned, the version (https://github.com/sheerlox/import-from-esm/releases/tag/v1.4.0-alpha.1) is just not used yet.

That didn't fix it for me.

It worked for me, when I:

  • updated import-from-esm to 1.4.0-alpha.1
  • added conventional-changelog-conventionalcommits to the top-level package.json, not in the workspace where semantic-release is

So importing when the dependency is only given inside the workspace is still broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants