Closed cefn closed 1 year ago
How did you install this? node_modules/.bin/rimraf
should be a symlink to the module at node_modules/rimraf/dist/cjs/src/bin.js
, and you'll find there is indeed a package.json at node_modules/rimraf/dist/cjs/package.json
.
What does ls -laF node_modules/.bin/rimraf
report?
Oh, I see, you're just viewing the file in VSCode. Yes, that's normal.
Node loads symlinks based on their realpath location, so it'll load from the actual module path, not the symlink path. It should work at runtime just fine. (If it doesn't, or if node_modules/.bin/rimraf
isn't actually a symlink, then yes, something is very broken.)
I encountered it twice when installing from a package in a monorepo from a clean start (a package which is logically-self-contained with no resolutions elsewhere in the repo).
Eventually found a third git clean and a different install sequence seemed to cause it to go away and it wasn't replicated in CI (where the repo as a whole - its top-level packages and contained packages - get a lerna bootstrap
from the beginning).
Because rimraf
is called in the package.json "prepare"
target as part of the build perhaps something wasn't yet finalised about the installed filesystem when that target runs. If I find the sequence to recreate it again I'll capture the file metadata you describe and report back.
Thanks for taking the time.
During local install of a package folder having
rimraf
as a dev dependency, rimraf is attempting to access a path which really can't sensibly exist where it's looking for it. One folder above thenode_modules/.bin/rimraf
file is thenode_modules
folder which can't be expected to contain rimraf'spackage.json
.You can see the relative folder structure revealed in this vscode screenshot.
The result is the following fatal error when trying to invoke
rimraf
from apackage.json
script target...