Something went wrong installing the "sharp" module Cannot find module '../build/Release/sharp-linux-x64.node' on Ubuntu

Affected page

Contribution Guidelines | freeCodeCamp.org

To reproduce

npm run develop versions: node v14.17.10 npm v6.14.13

log

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'develop' ]
2 info using npm@6.14.13
3 info using node@v14.17.0
4 verbose run-script [ 'predevelop', 'develop', 'postdevelop' ]
5 info lifecycle @freecodecamp/freecodecamp@0.0.1~predevelop: @freecodecamp/freecodecamp@0.0.1
6 verbose lifecycle @freecodecamp/freecodecamp@0.0.1~predevelop: unsafe-perm in lifecycle true
7 verbose lifecycle @freecodecamp/freecodecamp@0.0.1~predevelop: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/divyansh/Desktop/Projects/Open Source/freeCodeCamp/node_modules/.bin:/opt/firefox/firefox:/home/divyansh/anaconda3/bin:/home/divyansh/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
8 verbose lifecycle @freecodecamp/freecodecamp@0.0.1~predevelop: CWD: /home/divyansh/Desktop/Projects/Open Source/freeCodeCamp
9 silly lifecycle @freecodecamp/freecodecamp@0.0.1~predevelop: Args: [ '-c', 'npm run ensure-env' ]
10 silly lifecycle @freecodecamp/freecodecamp@0.0.1~predevelop: Returned: code: 0  signal: null
11 info lifecycle @freecodecamp/freecodecamp@0.0.1~develop: @freecodecamp/freecodecamp@0.0.1
12 verbose lifecycle @freecodecamp/freecodecamp@0.0.1~develop: unsafe-perm in lifecycle true
13 verbose lifecycle @freecodecamp/freecodecamp@0.0.1~develop: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/divyansh/Desktop/Projects/Open Source/freeCodeCamp/node_modules/.bin:/opt/firefox/firefox:/home/divyansh/anaconda3/bin:/home/divyansh/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
14 verbose lifecycle @freecodecamp/freecodecamp@0.0.1~develop: CWD: /home/divyansh/Desktop/Projects/Open Source/freeCodeCamp
15 silly lifecycle @freecodecamp/freecodecamp@0.0.1~develop: Args: [ '-c', 'npm-run-all build:curriculum -p develop:*' ]
16 silly lifecycle @freecodecamp/freecodecamp@0.0.1~develop: Returned: code: 1  signal: null
17 info lifecycle @freecodecamp/freecodecamp@0.0.1~develop: Failed to exec develop script
18 verbose stack Error: @freecodecamp/freecodecamp@0.0.1 develop: `npm-run-all build:curriculum -p develop:*`
18 verbose stack Exit status 1
18 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
18 verbose stack     at EventEmitter.emit (events.js:376:20)
18 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
18 verbose stack     at ChildProcess.emit (events.js:376:20)
18 verbose stack     at maybeClose (internal/child_process.js:1055:16)
18 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
19 verbose pkgid @freecodecamp/freecodecamp@0.0.1
20 verbose cwd /home/divyansh/Desktop/Projects/Open Source/freeCodeCamp
21 verbose Linux 5.11.0-37-generic
22 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "develop"
23 verbose node v14.17.0
24 verbose npm  v6.14.13
25 error code ELIFECYCLE
26 error errno 1
27 error @freecodecamp/freecodecamp@0.0.1 develop: `npm-run-all build:curriculum -p develop:*`
27 error Exit status 1
28 error Failed at the @freecodecamp/freecodecamp@0.0.1 develop script.
28 error This is probably not a problem with npm. There is likely additional logging output above.
29 verbose exit [ 1, true ]

error

image

I have tried all other solution from switching to nodev14.17.10 to installing libvips for linux (solution to a SO question) and rebuilding sharp, installing gatsby globally, running npm install --ignore-scripts=false

Welcome there,

It sounds like you did not run npm ci, before running npm run develop. Or, npm ci did not succeed (look at the full output for running it.

Hope this helps

npm ci gives no errors only npm run develop does, and i can run gatsby normally too. Plus, I can see sharp installed in the node_modules


this is what it says

Option 1:
rm -rf node_modules/

npm ci

if option 1 not work try option 2

Option 2:
npm cache clean --force

npm ci

Option 2 worked for me ,
let me know if it works:)

I have seen it happen a few times and (at least on Windows) what has worked for me is deleting the node_modules folder inside the client folder and then run npm install from inside the client folder. After, cd back out to the root and run the develop script (assuming everything else was installed already).

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.