mapbox / node-pre-gyp

Node.js tool for easy binary deployment of C++ addons
BSD 3-Clause "New" or "Revised" License
1.12k stars 263 forks source link

Not working with Node.js 15 #581

Closed adnan-kamili closed 3 years ago

adnan-kamili commented 3 years ago

My app works fine with node-pre-gyp up to Node v14.x. On Node v15.x it fails with the following error:

npm ERR! code 127
npm ERR! path /Volumes/Data/xxx/**-js/examples/node_modules/@***/***
npm ERR! command failed
npm ERR! command sh -c ./node_modules/.bin/node-pre-gyp install --fallback-to-build
npm ERR! sh: ./node_modules/.bin/node-pre-gyp: No such file or directory

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/*/.npm/_logs/2021-04-16T05_53_48_598Z-debug.log
bmacnaughton commented 3 years ago

i don't have a windows computer to test on but i am able to install lexfloatclient in a skeleton app, on node 15.14.0 on ubuntu 20.04.

@adnan-kamili - can you provide any additional details that would enable us to see what causes node-pre-gyp not to be found in node_modules/.bin?

it's not clear what os, what application is being installed (i guessed lexfloatclient because of a previous post), and some steps about what version of the application to try to install (even if from a github branch)?

adnan-kamili commented 3 years ago

I tried this on macOS 11 and docker ubuntu:latest and it failed on both.

bmacnaughton commented 3 years ago

can you let me know what specific package that used node-pre-gyp you're trying to install? as i mentioned, i was able to install lexfloatclient without error. i don't have enough information to reproduce the error. if there is a specific version of that package, that's important too.

and while i'm not sure how it could make a difference, it might be helpful to know the app that is installing the package using node-pre-gyp.

adnan-kamili commented 3 years ago

It works for npm 6.x but fails for npm v7.9.0

Try installing @cryptlex/lexfloatclient v4.5.2 using npm 7.

bmacnaughton commented 3 years ago

thank you for the additional information; i am able to reproduce the problem using npm 7.

the lexfloatclient package is a bit odd in that it doesn't have node-pre-gyp as a dependency in package.json, only in package-lock.json yet it obviously runs it.

i suggest that you add @mapbox/node-pre-gyp as a dependency. the non-scoped node-pre-gyp is no longer maintained as is quite a bit out-of-date (package-lock.json is referencing v0.14.0 which is quite old.

if your install doesn't work with @mapbox/node-pre-gyp (you should get v1.04) added as a dependency in package.json (and package-lock.json) then i will look at this in detail.

i appreciate the specific information.

bmacnaughton commented 3 years ago

note: it appears that npm@7 has different behavior when a package is listed in package-lock.json but not in package.json AND (i'm guessing) package-lock.json is older than package.json.

springmeyer commented 3 years ago

nice work figuring that out @bmacnaughton 🙇 @adnan-kamili - sounds like the problem is that your package.json needs updated. If that does not fix things with npm7, please let us know.

adnan-kamili commented 3 years ago

Thanks