-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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] npx cannot run bin script of github dependency when “build“ script included in package.json #4003
Comments
The `npx` command seems to fail because of the github dependencies that are used in services. I am saying "seems", because I am not sure, but running `npx --loglevel verbose ` Also, there are some issues on the NPM repo mentioning problems with github dependencies: npm/cli#4137 npm/cli#4003 I don't think many people use them in production, so that's why I expect I didn't find the exact issue. Gladly, I empirically found out that replacing `npx` with `npm exec` works. Also `npm i` works. Also, after doing `npm i` the `npx` starts to work (likely because it uses the cached package downloaded by npm - also this was probably a reason why the package worked for people testing https://api3dao.atlassian.net/browse/BEC-138).
The `npx` command seems to fail because of the github dependencies that are used in services. I am saying "seems", because I am not sure, but running `npx --loglevel verbose --package @api3/services --call "create-beacon-reader-app --help"` fails after downloading the utility contracts package. Also, there are some issues on the NPM repo mentioning problems with github dependencies: npm/cli#4137 npm/cli#4003 I don't think many people use them in production, so that's why I expect I didn't find the exact issue. Gladly, I empirically found out that replacing `npx` with `npm exec` works. Also `npm i @api3/services` works. Also, after doing `npm i` the `npx` starts to work (likely because it uses the cached package downloaded by npm - also this was probably a reason why the package worked for people testing https://api3dao.atlassian.net/browse/BEC-138).
Confirm - issues is still here with versions:
|
this is expected and intentional behavior. if a git dependency defines a if you have pre-built artifacts (like you do in your |
Thank you for the explanation:
Essentially:
I am more than happy/willing to draft suggested documentation updates… but trying to establish the facts first. There is also a CLI consideration here: Aside from the exit code there is no message to indicate the problem (even with a loglevel of silly). Originally it was only by process of elimination which revealed the build script was the problem. |
I just ran into this issue with a package I haven't tried since npm 6.x and am now running npm 9.x. I could not find any documentation describing that a script named Thanks to @mbtts for documenting this unexpected behavior, as this bug is a very frustrating time sink, and some documentation or a hint in the output would be appreciated. @nlf, I wonder if these 4M npm packages know that |
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
I am attempting to run a command from a github package containing a
build
script:The exit code is 1.
Output with
loglevel
ofsilly
.:When attempting an almost identical package (with a
build-
script instead of abuild
script):The exit code is 0.
Output with
loglevel
ofsilly
.:Expected Behavior
I expect the behaviour to be the same regardless of whether the script is named
build
orbuild-
.I also expect the same behaviour from earlier versions of
npx
(for example npm v6.14.15 on Node.js v14.18.1).The bin script should run and print “hello“:
If it is not possible to use a
build
script with a github dependency run via npx then I would expect this to be clearly documented.Steps To Reproduce
.npmrc
npx -y mbtts/npx-build-script
'To reproduce the working example (same environment/config):
npx -y mbtts/npx-build-script#fixed
'You can compare the original and fixed versions to prove the only difference is the script name.
Environment
The text was updated successfully, but these errors were encountered: