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

Install fails: TypeError: Class constructor Range cannot be invoked without 'new' #141

Closed
Powersource opened this issue Jan 8, 2020 · 8 comments

Comments

@Powersource
Copy link
Contributor

On commit 694893416576229337993a22ac0c6c486dc13b87 and with a removed node_modules, i get this on npm i:

make[2]: Leaving directory '/home/me/prj/web/cabal-cli/node_modules/sodium-native/libsodium/test'
make[1]: Leaving directory '/home/me/prj/web/cabal-cli/node_modules/sodium-native/libsodium/test'
make[1]: Entering directory '/home/me/prj/web/cabal-cli/node_modules/sodium-native/libsodium'
make[2]: Entering directory '/home/me/prj/web/cabal-cli/node_modules/sodium-native/libsodium'
make[2]: Nothing to be done for 'install-exec-am'.
 /usr/bin/mkdir -p '/home/me/prj/web/cabal-cli/node_modules/sodium-native/tmp/lib/pkgconfig'
 /usr/bin/install -c -m 644 libsodium.pc '/home/me/prj/web/cabal-cli/node_modules/sodium-native/tmp/lib/pkgconfig'
make[2]: Leaving directory '/home/me/prj/web/cabal-cli/node_modules/sodium-native/libsodium'
make[1]: Leaving directory '/home/me/prj/web/cabal-cli/node_modules/sodium-native/libsodium'
gyp ERR! UNCAUGHT EXCEPTION 
gyp ERR! stack TypeError: Class constructor Range cannot be invoked without 'new'
gyp ERR! stack     at PythonFinder.<anonymous> (/usr/lib/node_modules/node-gyp/lib/find-python.js:229:28)
gyp ERR! stack     at PythonFinder.execFileCallback (/usr/lib/node_modules/node-gyp/lib/find-python.js:274:7)
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:294:7)
gyp ERR! stack     at ChildProcess.emit (events.js:321:20)
gyp ERR! stack     at maybeClose (internal/child_process.js:1028:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
gyp ERR! System Linux 5.4.8-arch1-1
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/me/prj/web/cabal-cli/node_modules/sodium-native
gyp ERR! node -v v13.6.0
gyp ERR! node-gyp -v v6.0.1
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR!     <https://github.com/nodejs/node-gyp/issues>
npm ERR! code ELIFECYCLE
npm ERR! errno 7
npm ERR! sodium-native@2.4.6 install: `node-gyp-build "node preinstall.js" "node postinstall.js"`
npm ERR! Exit status 7
npm ERR! 
npm ERR! Failed at the sodium-native@2.4.6 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
% node --version
v13.6.0
% npm --version
6.13.4
@Powersource
Copy link
Contributor Author

I have a feeling it might be arch's really recent node version, which was released yesterday! @christianbundy do you get the same?

@christianbundy
Copy link

Thanks for the ping. It's working fine for me, but I'm on Node 12. Maybe it'd be worth checking to see if you can npm install sodium-native? I recently opened an issue on that repo about getting Node.js 13 prebuilds: sodium-friends/sodium-native#116

@Powersource
Copy link
Contributor Author

Yeah something like that issue is up, in cabal-desktop I'm getting

Uncaught Error: The module '/home/me/prj/web/cabal-desktop/node_modules/sodium-native/build/Release/sodium.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 79. This version of Node.js requires
NODE_MODULE_VERSION 70. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).

@christianbundy
Copy link

Oh, did you recently upgrade your Node.js version? If so, you'll need to rebuild your native modules.

What happened when you ran npm rebuild or npm install?

@Powersource
Copy link
Contributor Author

npm install was what I ran to get in this situation :p and running it again or rebuild didn't change anything :/

Yeah updated to 13.6 today, but my system seems to have updated to 13 in november (haven't used cabal since then but other stuff)

@christianbundy
Copy link

Sorry, I didn't notice that your error was about cabal-desktop. My guess is that's an Electron thing, you probably need npm run postinstall for that (and make sure you're starting it with Electron 5, not Node.

Anyway, I think it would probably be best to have you try to npm install in sodium-native and file an issue there if it doesn't work with Node 13.

@Powersource
Copy link
Contributor Author

Yep opened a new issue there now sodium-friends/sodium-native#117

@vladimiry
Copy link

vladimiry commented Feb 5, 2020

Uncaught Error: The module '/home/me/prj/web/cabal-desktop/node_modules/sodium-native/build/Release/sodium.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 79. This version of Node.js requires
NODE_MODULE_VERSION 70. Please try re-compiling or re-installing
the module (for instance, using npm rebuild or npm install).

Electron comes with node v12 but when you install node modules prebuild binaries will be downloaded for the nodejs version used. This is why you get the above-quoted error when you execute the Electron app.

Try running npx electron-builder install-app-deps being located in the project folder. That should download prebuilds binaries or compile them for the Electron version used. If no luck then I'd recommend trying performing these steps:

  • remove ./node_modules/prebuild-install just to make sure prebuild binaries won't be downloaded/used.
  • remove ./node_modules/keytar/build and ./node_modules/keytar/prebuilds
  • execute npx electron-builder install-app-deps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants