Skip to content

check sharp module already loaded#2918

Merged
lovell merged 2 commits intolovell:masterfrom
dkrnl:master
Oct 17, 2021
Merged

check sharp module already loaded#2918
lovell merged 2 commits intolovell:masterfrom
dkrnl:master

Conversation

@dkrnl
Copy link
Copy Markdown
Contributor

@dkrnl dkrnl commented Oct 6, 2021

Hi!
More readable error if sharp already loaded in peer deps.

e.g.:

test.js

const favicons = require('favicons'); 
const sharp = require('sharp');

output:

node ./test.js

Something went wrong installing the "sharp" module

The specified procedure could not be found.
\\?\/home/sharp-something-wrong/node_modules/sharp/build/Release/sharp-win32-x64.node

Possible solutions:
- Install with the --verbose flag and look for errors: "npm install --ignore-scripts=false --verbose sharp"
- Install for the current runtime: "npm install --platform=win32 --arch=x64 sharp"
- Consult the installation documentation: https://sharp.pixelplumbing.com/install
- Module already loaded in: /home/sharp-something-wrong/node_modules/favicons/node_modules/sharp/build/Release/sharp.node

npm ls sharp

+-- favicons-webpack-plugin@5.0.2
| `-- favicons@6.2.2
|   `-- sharp@0.28.3
`-- sharp@0.29.1
@lovell
Copy link
Copy Markdown
Owner

lovell commented Oct 6, 2021

Hi, thank you for this PR, it will definitely make a useful addition to the help.

Please can you make this Windows only, and perhaps modify the solution message to read something like "Ensure version aligns with".

@dkrnl
Copy link
Copy Markdown
Contributor Author

dkrnl commented Oct 6, 2021

Ok. fixed.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling 2ea9a3e on dkrnl:master into f37ca82 on lovell:master.

@lovell lovell merged commit e475d9e into lovell:master Oct 17, 2021
@lovell
Copy link
Copy Markdown
Owner

lovell commented Oct 17, 2021

Thank you!

@lovell lovell added this to the v0.29.2 milestone Oct 17, 2021
lovell added a commit that referenced this pull request Oct 17, 2021
martinj pushed a commit to aptoma/sharp that referenced this pull request Mar 31, 2022
martinj pushed a commit to aptoma/sharp that referenced this pull request Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants