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 run not working on every packages #2345

Closed
Yuri6037 opened this issue Dec 14, 2020 · 4 comments
Closed

[BUG] npm run not working on every packages #2345

Yuri6037 opened this issue Dec 14, 2020 · 4 comments
Labels
Bug thing that needs fixing Release 7.x work is associated with a specific npm 7 release

Comments

@Yuri6037
Copy link

Yuri6037 commented Dec 14, 2020

Current Behavior:

Some packages (especially privately hosted ones) fails when invoked by a script of another package. The error is always the same: 127 meaning command not found.
All of the private packages exposes a main.js which redirects to an index.js generated by tsc at package build time. I verified that both the index.js and main.js exists. Each private package.json has a bin entry mapping to the index.js file.
When the private package is installed by npm v6.14.9 everything is fine. When the private package is installed by npm v7.0.15 it's broken.
However packages like typescript tsc and webpack still works fine.

Expected Behavior:

No 127 error

Steps To Reproduce:

  1. Create a private package exporting a bin entry pointing to an index.js which includes a main.js built by typescript tsc
  2. Publish this package
  3. Create an electron application and reference the private package as a dev dependency
  4. Create a script that calls the private package exposed bin
  5. Run npm install on the electron app
  6. Run the npm script
  7. Enjoy error 127

Environment:

Machine with npm v7

  • npm 7.0.15
  • docker node:latest image
  • Invoked by gitlab-ci
  • Hardware is very limited: 4 GB RAM Core i3 2.4 Ghz 2 Cores 4 Threads
  • Host machine is running debian 10

Machine with npm v6

  • npm 6.14.9
  • node 12.18.2
  • no docker
  • Core i7 3.7 Ghz 4 cores 8 threads 24 GB RAM
  • OS: Pop! OS 20.10

EDIT: I just confirmed: the exact identical same host machine configuration with gitlab-ci runner but node:lts instead of node:latest resolves all problems. Which means the problem is forcely related to node:latest docker image.

@Yuri6037 Yuri6037 added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Dec 14, 2020
@ljharb
Copy link
Contributor

ljharb commented Dec 14, 2020

What do you mean, "a script of another package"? Scripts are only runnable in the current package; binaries (the "bin" field) are what's runnable from installed packages.

@Yuri6037
Copy link
Author

By other package I mean:

  • Package A built as said in steps 1-2
  • Package B is the electron app
  • Package B refers to Package A by one of it's script and a dev dependency
  • npm install is ran over Package B to allow Package A to be installed

@darcyclarke
Copy link
Contributor

@Yuri6037 can you try updating to the latest v7 (ex. npm i -g npm@7) - you may also need to update your lockfile via installing with npm v6 & then run install again with v7 (should fix/migrate your lockfile).

@darcyclarke darcyclarke removed the Needs Triage needs review for next steps label Jan 29, 2021
@wraithgar
Copy link
Member

Closing due to inactivity. If this is still a problem with npm@7 please open a new ticket and follow the prompts to give as much information as possible to debug further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

No branches or pull requests

4 participants