Open iyegoroff opened 2 years ago
Your package.json
is in packages/bar/
and referring to packages/foo/
. Since it’s a relative path, your package.json
is clearly referring to packages/bar/packages/foo/
. For your installed foo
, packages/bar/node_modules/foo
, this is ../packages/foo/
.
If you want to refer to package/foo/
(an absolute path) from package/bar/
(an absolute path), use the relative path file:../foo/
.
You’ll face the real bug #4994, though.
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
When workspace
packages/bar
has workspacepackages/foo
as a dependencynpm i
creates invalidfoo
symlink insidepackages/bar/node_modules
folder.Folder structure and
packages/bar/package.json
file:readlink packages/bar/node_modules/foo
prints../packages/foo
.Expected Behavior
npm i
creates valid symlinks inside workspacenode_modules
folder.readlink packages/bar/node_modules/foo
prints../../../packages/foo
.Steps To Reproduce
Repro is here https://github.com/iyegoroff/npm-workspaces-symlink-bug
The output will be an error:
sh: ./node_modules/foo/index.js: No such file or directory
. Correct output should befoo works!
.This also reproduces when running Github Actions.
Environment