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

@lerna/legacy-package-management missing dependency on rimraf #3611

Closed
keeganstreet opened this issue Mar 24, 2023 · 12 comments · Fixed by #3614
Closed

@lerna/legacy-package-management missing dependency on rimraf #3611

keeganstreet opened this issue Mar 24, 2023 · 12 comments · Fixed by #3614

Comments

@keeganstreet
Copy link

Current Behavior

Error when running lerna after 6.6.0 release

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './bin' is not defined by "exports" in node_modules/rimraf/package.json

Expected Behavior

The new @lerna/legacy-package-management module imports from rimraf, so it probably needs to specify rimraf as a dependency to ensure it gets the correct version

RIMRAF_CLI = require.resolve("rimraf/bin");
@buffcode
Copy link

Error and stack trace:

$ /builds/node_modules/.bin/lerna bootstrap
node:internal/modules/cjs/loader:488
      throw e;
      ^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './bin' is not defined by "exports" in /builds/node_modules/rimraf/package.json
    at new NodeError (node:internal/errors:372:5)
    at throwExportsNotFound (node:internal/modules/esm/resolve:472:9)
    at packageExportsResolve (node:internal/modules/esm/resolve:753:3)
    at resolveExports (node:internal/modules/cjs/loader:482:36)
    at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
    at Function.resolve (node:internal/modules/cjs/helpers:108:19)
    at libs/core/src/lib/rimraf-dir.ts (/builds/node_modules/@lerna/legacy-package-management/dist/index.js:3574:26)
    at __init (/builds/node_modules/@lerna/legacy-package-management/dist/index.js:10:56)
    at libs/core/src/index.ts (/builds/node_modules/@lerna/legacy-package-management/dist/index.js:3942:5)
    at __init (/builds/node_modules/@lerna/legacy-package-management/dist/index.js:10:56)
    at libs/commands/add/src/command.ts (/builds/node_modules/@lerna/legacy-package-management/dist/index.js:4613:5)
    at __require (/builds/node_modules/@lerna/legacy-package-management/dist/index.js:13:50)
    at Object.<anonymous> (/builds/node_modules/@lerna/legacy-package-management/dist/index.js:4884:22)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

@char0n
Copy link

char0n commented Mar 24, 2023

Yep, I can confirm. 6.6.0 is unsable as it tries to import rimraf/bin which is not exported by rimraf package via exports field.

@HitkoDev
Copy link

HitkoDev commented Mar 24, 2023

Is there a way to get rid of @lerna/legacy-package-management altogether if I don't need it? As far as I understand it only provides a handful of deprecated commands, and I don't use any of those commands.

@tada5hi
Copy link
Contributor

tada5hi commented Mar 24, 2023

i implemented a hot fix. Hopefully this will be reviewed and merged soon.

@JamesHenry
Copy link
Member

@HitkoDev in v7 of lerna (coming next month) it will no longer be installed by default, and folks would have to opt into it. It needs to stick around until the major release because it's a significant breaking change

@JamesHenry
Copy link
Member

Thanks for the PR @tada5hi I'll take a look!

@tada5hi
Copy link
Contributor

tada5hi commented Mar 24, 2023

@JamesHenry I was very happy to do that ✌️ ☺️ I hope you can make use of it.

@JamesHenry
Copy link
Member

I'm pleased to say our e2e tests do actually catch this issue: #3616

It must be that in the workspaces of the folks affected here you are forcing lerna to use rimraf v4 even though it currently depends on v3?

@char0n
Copy link

char0n commented Mar 25, 2023

It must be that in the workspaces of the folks affected here you are forcing lerna to use rimraf v4 even though it currently depends on v3?

Nope that's not the case. If you do fresh install of lerna, you'll get rimraf@4.4.1 with it.

$ npm i --verbose lerna@6.6.0
$ cat ./node_modules/rimraf/package.json

Edit: changed "6.6.1" to "6.6.0"

@JamesHenry
Copy link
Member

@char0n 6.6.1 was released yesterday after this comment - I upgraded to the latest rimraf as part of the work to fix this issue.

The comment applied to 6.6.0 and earlier

@char0n
Copy link

char0n commented Mar 25, 2023

@JamesHenry,

You're right. Sorry, it failed for 6.6.0 - swagger-api/apidom#2650 and I don't have any overrides defined in package.json.

@JamesHenry
Copy link
Member

I guess your direct devDependency on it was somehow enough, strange… anyway glad it’s resolved now!

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

Successfully merging a pull request may close this issue.

6 participants