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

[BUG] npm does not find executables from other packages if package using it is installed from local directory #4120

Open
2 tasks done
mlederhi opened this issue Dec 3, 2021 · 0 comments
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release

Comments

@mlederhi
Copy link

mlederhi commented Dec 3, 2021

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

Npm does not find executables registered in the "bin" section of package a, needed by package b if package b is installed from a local directory (and thus symblinked into the node_modules directory).

Expected Behavior

Npm does find executables.

Steps To Reproduce

bug.zip

  1. Extract bug.zip
  2. cd bug
  3. mkdir install
  4. cd install
  5. npm install ../pkg_a
  6. npm install ../pkg_b
  7. cd node_modules/pkg_b
  8. npm run build

Output of step 8:


> pkg_b@1.0.0 build
> echo $PATH; builder

/home/lederhi/Downloads/bug/pkg_b/node_modules/.bin:/home/lederhi/Downloads/bug/node_modules/.bin:/home/lederhi/Downloads/node_modules/.bin:/home/lederhi/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/home/lederhi/Downloads/node-v16.13.1-linux-x64/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/home/lederhi/Downloads/node-v16.13.1-linux-x64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/12/bin
sh: line 1: builder: command not found

Note: wrong PATH generation happens probably because packages are symlinked into the node_modules directory upon package installation. If I replace the symlinked package with a real copy of the package, then it works.

Environment

  • npm: 8.1.2
  • Node: 16.13.1
  • OS: Gentoo Linux
  • platform: PC
  • npm config:
; "user" config from /home/lederhi/.npmrc

https-proxy = "http://proxy.fts.linz:3128/" 
proxy = "http://proxy.fts.linz:3128/" 
registry = "http://registry.npmjs.com/" 
strict-ssl = false 

; node bin location = /home/lederhi/Downloads/node-v16.13.1-linux-x64/bin/node
; cwd = /home/lederhi/Downloads/bug/pkg_b
; HOME = /home/lederhi
; Run `npm config ls -l` to show all defaults.
@mlederhi mlederhi added Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release labels Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

No branches or pull requests

1 participant