I'm working with a lerna
project that uses npm
and uncertain whether this is a lerna or npm issue.
The structure of the project is like this
- package.json (root)
- package-lock.json
- lerna.json
- packages/
- main-package/
- package.json
- package-lock.json
- ...
- aux-package/
- package.json
- package-lock.json
- ...
In main-package/package.json
, there is a localPeerDependencies entry
"localPeerDependencies": {
"aux-package": "0.0.0-0",
...
}
and aux-package's version field matches that value.
Inside the main-package
directory, I can run the build script just fine and things work correctly. However, I've modified the code so that aux-package
is no longer needed as a dependency and thus the peerLocalDependencies entry can can be deleted.
Running npm remove aux-package
gives me the following error
npm ERR! code ETARGET
npm ERR! notarget No matching version found for [email protected].
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
Running npm prune
gives the same error.
I suppose I could manually delete the relevant entries in package.json, package-lock.json, then remove the node_modules folder and reinstall. However I'm hoping to really understand the underlying problem.
First off, is this a lerna
issue or npm
?
Secondly, what is "the right way" to uninstall packages in localPeerDependencies
in the year 2023?
Thank you in advance for any pointers in the right direction!
In main-package
, it looks like package.json, package-lock.json, and node_modules/.package-lock.json just got out of sync so the error was just the result of that.
To fix this, I had to the following 1 time to get the correct linkages back:
rm -rf node_modules. #at the main-package level
lerna link #at the project root level
npm install # at the main-package level
Seem to be smooth sailing from there.