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

"node: command not found" when using nvm and sudo/root #2633

Closed
Markshall opened this issue Mar 22, 2021 · 2 comments
Closed

"node: command not found" when using nvm and sudo/root #2633

Markshall opened this issue Mar 22, 2021 · 2 comments

Comments

@Markshall
Copy link

I'm running an npm install script inside a directory that I've cloned from git, one of the dependancies is Sharp, but when I run npm install, it tells me that node and node-gyp commands don't exist and yells at me about an install script that Sharp tries to execute:
(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

My computer is running node 14.15.0 and npm 7.5.2 and it works fine there.
When I try on an Amazon Linux 2 EC2 instance to serve this app on the internet, running node 14.15.0 and npm 6.14.8 (through nvm), I get this crashing error.


Did you see the documentation relating to installation?
Yes

Have you ensured the architecture and platform of Node.js used for npm install is the same as the architecture and platform of Node.js used at runtime?
Yes (I think?). Using node 14.15.0 (npm 6.14.8) via nvm

Are you using the latest version? Is the version currently in use as reported by npm ls sharp the same as the latest version as reported by npm view sharp dist-tags.latest?
Yes (0.27.2)

If you are using npm v6 or earlier and installing as a root or sudo user, have you tried with the npm install --unsafe-perm flag?
Yes, I get the same error

If you are using npm v7, does the user running npm install own the directory it is run in?
N/A

If you are using the ignore-scripts feature of npm, have you tried with the npm install --ignore-scripts=false flag?
I don't use ignore-scripts, but I tried the flag regardless and got the same error.

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

npm info it worked if it ends with ok
npm verb cli [
npm verb cli   '/root/.nvm/versions/node/v14.15.0/bin/node',
npm verb cli   '/root/.nvm/versions/node/v14.15.0/bin/npm',
npm verb cli   'install',
npm verb cli   '--verbose',
npm verb cli   'sharp'
npm verb cli ]
npm info using [email protected]
npm info using [email protected]
npm verb npm-session 2f088e26edfac318
npm http fetch GET 304 https://registry.npmjs.org/sharp 99ms (from cache)
npm timing stage:loadCurrentTree Completed in 154ms
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 3ms
npm http fetch GET 304 https://registry.npmjs.org/array-flatten 66ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/npmlog 96ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/tar-fs 116ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/simple-get 119ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/tunnel-agent 117ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/detect-libc 132ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/semver 132ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/prebuild-install 140ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/color 148ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/node-addon-api 155ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/color-string 27ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/color-convert 76ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/color-name 42ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/simple-swizzle 28ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/is-arrayish 33ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/console-control-strings 45ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/set-blocking 45ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/are-we-there-yet 47ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/gauge 83ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/delegates 46ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/readable-stream 59ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/inherits 53ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/isarray 57ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/process-nextick-args 67ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/safe-buffer 68ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/core-util-is 70ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/string_decoder 72ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/util-deprecate 73ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/object-assign 11ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/aproba 47ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/signal-exit 56ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/wide-align 57ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/strip-ansi 58ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/string-width 66ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/has-unicode 69ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/code-point-at 33ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/is-fullwidth-code-point 65ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/number-is-nan 34ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/ansi-regex 32ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/expand-template 64ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/pump 70ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/napi-build-utils 94ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/minimist 96ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/github-from-package 103ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/mkdirp-classic 102ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/rc 101ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/node-abi 105ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/which-pm-runs 89ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/noop-logger 107ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/once 27ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/end-of-stream 38ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/wrappy 31ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/deep-extend 23ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/strip-json-comments 31ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/ini 40ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/simple-concat 43ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/decompress-response 81ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/mimic-response 40ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/tar-stream 32ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/chownr 49ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/bl 31ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/fs-constants 116ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/buffer 33ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/base64-js 33ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/ieee754 39ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/lru-cache 37ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/yallist 25ms (from cache)
npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 1524ms
npm timing stage:loadIdealTree Completed in 1555ms
npm timing stage:generateActionsToTake Completed in 18ms
npm verb correctMkdir /root/.npm/_locks correctMkdir not in flight; initializing
npm verb lock using /root/.npm/_locks/staging-dff8604cf3b8aea3.lock for /var/www/html/node_modules/.staging
npm timing audit submit Completed in 288ms
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 288ms
npm timing audit body Completed in 3ms
npm timing action:extract Completed in 348ms
npm timing action:finalize Completed in 73ms
npm timing action:refresh-package-json Completed in 189ms
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm timing action:preinstall Completed in 32ms
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm verb linkBins [
npm verb linkBins   { 'detect-libc': 'bin/detect-libc.js' },
npm verb linkBins   '/var/www/html/node_modules/.bin',
npm verb linkBins   false
npm verb linkBins ]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm verb linkBins [
npm verb linkBins   { semver: 'bin/semver' },
npm verb linkBins   '/var/www/html/node_modules/node-abi/node_modules/.bin',
npm verb linkBins   false
npm verb linkBins ]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm verb linkBins [
npm verb linkBins   { rc: 'cli.js' },
npm verb linkBins   '/var/www/html/node_modules/.bin',
npm verb linkBins   false
npm verb linkBins ]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm verb linkBins [
npm verb linkBins   { 'prebuild-install': 'bin.js' },
npm verb linkBins   '/var/www/html/node_modules/.bin',
npm verb linkBins   false
npm verb linkBins ]
npm info linkStuff [email protected]
npm verb linkBins [
npm verb linkBins   { semver: 'bin/semver.js' },
npm verb linkBins   '/var/www/html/node_modules/.bin',
npm verb linkBins   false
npm verb linkBins ]
npm info linkStuff [email protected]
npm info linkStuff [email protected]
npm timing action:build Completed in 33ms
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~install: [email protected]

> [email protected] install /var/www/html/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

sh: node: command not found
sh: node-gyp: command not found
npm verb lifecycle [email protected]~install: unsafe-perm in lifecycle false
npm verb lifecycle [email protected]~install: PATH: /root/.nvm/versions/node/v14.15.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/var/www/html/node_modules/sharp/node_modules/.bin:/var/www/html/node_modules/.bin:/root/.nvm/versions/node/v14.15.0/bin:/sbin:/bin:/usr/sbin:/usr/bin
npm verb lifecycle [email protected]~install: CWD: /var/www/html/node_modules/sharp
npm info lifecycle [email protected]~install: Failed to exec install script
npm timing action:install Completed in 38ms
npm verb unlock done using /root/.npm/_locks/staging-dff8604cf3b8aea3.lock for /var/www/html/node_modules/.staging
npm timing stage:rollbackFailedOptional Completed in 101ms
npm timing stage:runTopLevelLifecycles Completed in 2618ms

npm verb stack Error: [email protected] install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm verb stack spawn ENOENT
npm verb stack     at ChildProcess.<anonymous> (/root/.nvm/versions/node/v14.15.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
npm verb stack     at ChildProcess.emit (events.js:315:20)
npm verb stack     at maybeClose (internal/child_process.js:1048:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
npm verb pkgid [email protected]
npm verb cwd /var/www/html
npm verb Linux 4.14.219-164.354.amzn2.x86_64
npm verb argv "/root/.nvm/versions/node/v14.15.0/bin/node" "/root/.nvm/versions/node/v14.15.0/bin/npm" "install" "--verbose" "sharp"
npm verb node v14.15.0
npm verb npm  v6.14.8
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! [email protected] install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 1, true ]
npm timing npm Completed in 2995ms

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-03-22T14_04_57_489Z-debug.log

What is the output of running npx envinfo --binaries --system?

npx: installed 1 in 1.016s

  System:
    OS: Linux 4.14 Amazon Linux 2
    CPU: (2) x64 Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz
    Memory: 2.48 GB / 3.85 GB
    Container: Yes
    Shell: 4.2.46 - /bin/bash
  Binaries:
    Node: 14.15.0 - ~/.nvm/versions/node/v14.15.0/bin/node
    npm: 6.14.8 - ~/.nvm/versions/node/v14.15.0/bin/npm
@lovell
Copy link
Owner

lovell commented Mar 22, 2021

Hello, the salient part of the error is:

sh: node: command not found

Please can you ensure that Node.js has been installed correctly. I notice you're using nvm and running as sudo/root - check that it has modified the PATH correctly - you might have run into nvm-sh/nvm#43

@lovell lovell changed the title sharp install script causing error and refusing to install "node: command not found" when using nvm and sudo/root Mar 22, 2021
@Markshall
Copy link
Author

@lovell thanks for your quick reply. Weirdly, I think I've fixed it. I changed my node version to 14.15.0 on my EC2 instance, but installed the latest version of npm using nvm install --latest-npm which brought me to npm version 7.6.3 which I think solved my issue.
I had to run npm rebuild sharp and then managed to do npm install and it seemed to work no problem for me.

Not sure what the overriding issue was, perhaps a mismatch in npm versions?

Either way, this is solved for me for now so I'll close the comment. Loving Sharp by the way!

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

2 participants