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

Issue with Nodejs 13.8.0 #2084

Closed
averri opened this issue Feb 17, 2020 · 10 comments
Closed

Issue with Nodejs 13.8.0 #2084

averri opened this issue Feb 17, 2020 · 10 comments

Comments

@averri
Copy link

averri commented Feb 17, 2020

I'm trying to run sharp v0.24.1 with Nodejs v13.8.0 and this is the error when running the application (which works fine with Nodejs v.12):

/home/alex/dev/src/other/strenux/strenux-api/node_modules/sharp/lib/constructor.js:34
  throw new Error(error);

Error: 
Something went wrong installing the "sharp" module

Module did not self-register.

- Remove the "node_modules/sharp" directory then run
  "npm install --ignore-scripts=false --verbose" and look for errors
- Consult the installation documentation at https://sharp.pixelplumbing.com/install
- Search for this error at https://github.com/lovell/sharp/issues

    at Object.<anonymous> (/home/alex/dev/src/other/strenux/strenux-api/node_modules/sharp/lib/constructor.js:34:9)
    at Module._compile (internal/modules/cjs/loader.js:759:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Module.require (internal/modules/cjs/loader.js:666:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/home/alex/dev/src/other/strenux/strenux-api/node_modules/sharp/lib/index.js:3:15)
    at Module._compile (internal/modules/cjs/loader.js:759:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Module.require (internal/modules/cjs/loader.js:666:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/home/alex/dev/src/other/strenux/strenux-api/src/middleware/medias/jpg-storage.js:6:15)
    at Module._compile (internal/modules/cjs/loader.js:759:30)

I have removed node_modules and yarn.lock and run yarn install with no success.

@averri averri added the triage label Feb 17, 2020
@papandreou
Copy link
Contributor

I cannot reproduce this with node 13.8.0 and sharp 0.24.1, except if I npm install with a different major version of node than I'm running the code with:

$ nvm use 13.8.0
Now using node v13.8.0 (npm v6.13.6)
$ npm i sharp

> sharp@0.24.1 install /home/andreas/work/throwaway/sharpz/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

[...]

+ sharp@0.24.1
updated 1 package in 11.626s

2 packages are looking for funding
  run `npm fund` for details

$ node -e "require('sharp')"
$ nvm use 12
Now using node v12.10.0 (npm v6.10.3)
$ node -e "require('sharp')"
/home/andreas/work/throwaway/sharpz/node_modules/sharp/lib/constructor.js:34
  throw new Error(error);
  ^

Error: 
Something went wrong installing the "sharp" module

Module did not self-register.
[...]

Are you sure that npm --versions and node --version agree? Does npm rebuild fix it?

@lovell
Copy link
Owner

lovell commented Feb 17, 2020

  • Have you ensured the platform and version of Node.js used for npm install is the same as the platform and version of Node.js used at runtime?

  • If you are installing as a root or sudo user, have you tried with the npm install --unsafe-perm flag?

  • If you are using the ignore-scripts feature of npm, have you tried with the npm install --ignore-scripts=false flag?

  • What is the complete output of running npm install --verbose sharp? Have you checked this output for useful error messages?

@pfcodes
Copy link

pfcodes commented Feb 18, 2020

I cannot reproduce this with node 13.8.0 and sharp 0.24.1, except if I npm install with a different major version of node than I'm running the code with:

$ nvm use 13.8.0
Now using node v13.8.0 (npm v6.13.6)
$ npm i sharp

> sharp@0.24.1 install /home/andreas/work/throwaway/sharpz/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

[...]

+ sharp@0.24.1
updated 1 package in 11.626s

2 packages are looking for funding
  run `npm fund` for details

$ node -e "require('sharp')"
$ nvm use 12
Now using node v12.10.0 (npm v6.10.3)
$ node -e "require('sharp')"
/home/andreas/work/throwaway/sharpz/node_modules/sharp/lib/constructor.js:34
  throw new Error(error);
  ^

Error: 
Something went wrong installing the "sharp" module

Module did not self-register.
[...]

Are you sure that npm --versions and node --version agree? Does npm rebuild fix it?

Current version of npm is 6.13.7 as of 20 days ago. Using that version I'm unable to install as well with Node 13.8.0.

Update: No error when installing with yarn. This issue only happens when sharp is installed with npm through a Gatsby installation due to issues with one of it's packages which I traced to be the gatsby-source-contentful package (gatsbyjs/gatsby#16455).

@lovell
Copy link
Owner

lovell commented Feb 18, 2020

Please ensure there are no conflicting or globally-installed outdated versions of sharp. The output of the following commands will help determine this:

npm ls sharp
npm ls -g sharp

@ntelkedzhiev
Copy link

ntelkedzhiev commented Feb 20, 2020

I can confirm that this is an issue when running node 13.8.0. Switching to an older version doesn't trigger the error.

@lovell
Copy link
Owner

lovell commented Feb 20, 2020

@ntelkedzhiev Have you ensured the platform and version of Node.js used for npm install is the same as the platform and version of Node.js used at runtime?

@ntelkedzhiev
Copy link

@ntelkedzhiev Have you ensured the platform and version of Node.js used for npm install is the same as the platform and version of Node.js used at runtime?

Yes.

@lovell
Copy link
Owner

lovell commented Feb 24, 2020

There's existing help for Electron users at https://sharp.pixelplumbing.com/install#electron

@lovell
Copy link
Owner

lovell commented Feb 24, 2020

@averri Were you able to make any progress with this?

@averri
Copy link
Author

averri commented Mar 2, 2020

I have reverted the project to Node 12.16.0. It could be reopened again if someone find a reproducible steps.

@averri averri closed this as completed Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants