sh: node: command not found - when npm install command on AWS Instance - javascript

I want to run a node app on AWS EC2 instance. I installed node through this official method by AWS Doc https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-up-node-on-ec2-instance.html.
Then, I can view the version of node and npm but when I give the command npm install on the node app folder , it starts to install a few dependencies and then it fails. with the error as
> core-js#2.6.11 postinstall /var/apps/backend-master/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
sh: node: command not found
npm WARN mysql_db#1.0.0 No description
npm WARN mysql_db#1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! core-js#2.6.11 postinstall: `node -e "try{require('./postinstall')}catch(e){}"`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the core-js#2.6.11 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-06-16T19_28_07_911Z-debug.log
Do let me know if there is an additional step to do or if I am wrong somewhere

Related

Npm install dependencies error (pdf.js plugin)

Please help JS wizards!
On M1 Macbook Pro.
npm version 8.12.1
Package:
https://github.com/mozilla/pdf.js
Error on npm install
[master][~/__Dev/_NewApps/pdf.js]$ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: eslint-plugin-mozilla#2.12.3
npm ERR! Found: eslint-plugin-prettier#4.0.0
npm ERR! node_modules/eslint-plugin-prettier
npm ERR! dev eslint-plugin-prettier#"^4.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint-plugin-prettier#"^3.0.0" from eslint-plugin-mozilla#2.12.3
npm ERR! node_modules/eslint-plugin-mozilla
npm ERR! dev eslint-plugin-mozilla#"^2.12.3" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: eslint-plugin-prettier#3.4.1
npm ERR! node_modules/eslint-plugin-prettier
npm ERR! peer eslint-plugin-prettier#"^3.0.0" from eslint-plugin-mozilla#2.12.3
npm ERR! node_modules/eslint-plugin-mozilla
npm ERR! dev eslint-plugin-mozilla#"^2.12.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/mike/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mike/.npm/_logs/2022-06-29T06_18_11_165Z-debug-0.log
Steps to reproduce the problem:
git clone https://github.com/mozilla/pdf.js.git
cd pdf.js
npm install -g gulp-cli
npm install
[master][~/__Dev/_NewApps/pdf.js]$ npm -v
8.12.1
I tried various updates and npm-check-updates-package to see if there is anything that needs to be updated but still got this error:
*[master][~/__Dev/_NewApps/pdf.js]$ npm install
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: pdf.js#undefined
npm WARN Found: eslint-plugin-prettier#4.0.0
npm WARN node_modules/eslint-plugin-prettier
npm WARN dev eslint-plugin-prettier#"^4.1.0" from the root project
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer eslint-plugin-prettier#"^3.0.0" from eslint-plugin-mozilla#2.12.3
npm WARN node_modules/eslint-plugin-mozilla
npm WARN dev eslint-plugin-mozilla#"^2.12.3" from the root project
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: eslint-plugin-mozilla#2.12.3
npm ERR! Found: prettier#2.7.1
npm ERR! node_modules/prettier
npm ERR! dev prettier#"^2.7.1" from the root project
npm ERR! peer prettier#">=2.0.0" from stylelint-prettier#2.0.0
npm ERR! node_modules/stylelint-prettier
npm ERR! dev stylelint-prettier#"^2.0.0" from the root project
npm ERR! 1 more (eslint-plugin-prettier)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer prettier#"^1.19.1" from eslint-plugin-mozilla#2.12.3
npm ERR! node_modules/eslint-plugin-mozilla
npm ERR! dev eslint-plugin-mozilla#"^2.12.3" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: prettier#1.19.1
npm ERR! node_modules/prettier
npm ERR! peer prettier#"^1.19.1" from eslint-plugin-mozilla#2.12.3
npm ERR! node_modules/eslint-plugin-mozilla
npm ERR! dev eslint-plugin-mozilla#"^2.12.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/mike/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mike/.npm/_logs/2022-06-29T06_24_32_162Z-debug-0.log
Running on M1 Macbook Pro.
Any help?
Also npm audit fix --force gives this massive error
[master][~/__Dev/_NewApps/pdf.js]$ npm audit fix --force
npm WARN using --force Recommended protections disabled.
npm WARN audit fix json-schema#0.2.3 node_modules/npm/node_modules/json-schema
npm WARN audit fix json-schema#0.2.3 is a bundled dependency of
npm WARN audit fix json-schema#0.2.3 npm#6.14.15 at node_modules/npm
npm WARN audit fix json-schema#0.2.3 It cannot be fixed automatically.
npm WARN audit fix json-schema#0.2.3 Check for updates to the npm package.
npm WARN audit fix minimist#1.2.0 node_modules/fsevents/node_modules/rc/node_modules/minimist
npm WARN audit fix minimist#1.2.0 is a bundled dependency of
npm WARN audit fix minimist#1.2.0 fsevents#1.2.9 at node_modules/fsevents
npm WARN audit fix minimist#1.2.0 It cannot be fixed automatically.
npm WARN audit fix minimist#1.2.0 Check for updates to the fsevents package.
npm WARN audit fix minimist#0.0.8 node_modules/fsevents/node_modules/minimist
npm WARN audit fix minimist#0.0.8 is a bundled dependency of
npm WARN audit fix minimist#0.0.8 fsevents#1.2.9 at node_modules/fsevents
npm WARN audit fix minimist#0.0.8 It cannot be fixed automatically.
npm WARN audit fix minimist#0.0.8 Check for updates to the fsevents package.
npm WARN audit fix minimist#1.2.5 node_modules/fsevents/node_modules/tar/node_modules/minimist
npm WARN audit fix minimist#1.2.5 is a bundled dependency of
npm WARN audit fix minimist#1.2.5 fsevents#1.2.9 at node_modules/fsevents
npm WARN audit fix minimist#1.2.5 It cannot be fixed automatically.
npm WARN audit fix minimist#1.2.5 Check for updates to the fsevents package.
npm WARN audit fix minimist#1.2.5 node_modules/npm/node_modules/minimist
npm WARN audit fix minimist#1.2.5 is a bundled dependency of
npm WARN audit fix minimist#1.2.5 npm#6.14.15 at node_modules/npm
npm WARN audit fix minimist#1.2.5 It cannot be fixed automatically.
npm WARN audit fix minimist#1.2.5 Check for updates to the npm package.
npm WARN audit fix minimist#1.2.5 node_modules/npm/node_modules/mkdirp/node_modules/minimist
npm WARN audit fix minimist#1.2.5 is a bundled dependency of
npm WARN audit fix minimist#1.2.5 npm#6.14.15 at node_modules/npm
npm WARN audit fix minimist#1.2.5 It cannot be fixed automatically.
npm WARN audit fix minimist#1.2.5 Check for updates to the npm package.
npm WARN audit fix ansi-regex#3.0.0 node_modules/npm/node_modules/string-width/node_modules/ansi-regex
npm WARN audit fix ansi-regex#3.0.0 is a bundled dependency of
npm WARN audit fix ansi-regex#3.0.0 npm#6.14.15 at node_modules/npm
npm WARN audit fix ansi-regex#3.0.0 It cannot be fixed automatically.
npm WARN audit fix ansi-regex#3.0.0 Check for updates to the npm package.
npm WARN audit fix ansi-regex#4.1.0 node_modules/npm/node_modules/cliui/node_modules/ansi-regex
npm WARN audit fix ansi-regex#4.1.0 is a bundled dependency of
npm WARN audit fix ansi-regex#4.1.0 npm#6.14.15 at node_modules/npm
npm WARN audit fix ansi-regex#4.1.0 It cannot be fixed automatically.
npm WARN audit fix ansi-regex#4.1.0 Check for updates to the npm package.
npm WARN audit fix ansi-regex#4.1.0 node_modules/npm/node_modules/wrap-ansi/node_modules/ansi-regex
npm WARN audit fix ansi-regex#4.1.0 is a bundled dependency of
npm WARN audit fix ansi-regex#4.1.0 npm#6.14.15 at node_modules/npm
npm WARN audit fix ansi-regex#4.1.0 It cannot be fixed automatically.
npm WARN audit fix ansi-regex#4.1.0 Check for updates to the npm package.
npm WARN audit fix ansi-regex#4.1.0 node_modules/npm/node_modules/yargs/node_modules/ansi-regex
npm WARN audit fix ansi-regex#4.1.0 is a bundled dependency of
npm WARN audit fix ansi-regex#4.1.0 npm#6.14.15 at node_modules/npm
npm WARN audit fix ansi-regex#4.1.0 It cannot be fixed automatically.
npm WARN audit fix ansi-regex#4.1.0 Check for updates to the npm package.
npm WARN audit fix got#6.7.1 node_modules/npm/node_modules/got
npm WARN audit fix got#6.7.1 is a bundled dependency of
npm WARN audit fix got#6.7.1 npm#6.14.15 at node_modules/npm
npm WARN audit fix got#6.7.1 It cannot be fixed automatically.
npm WARN audit fix got#6.7.1 Check for updates to the npm package.
npm WARN audit fix jsprim#1.4.1 node_modules/npm/node_modules/jsprim
npm WARN audit fix jsprim#1.4.1 is a bundled dependency of
npm WARN audit fix jsprim#1.4.1 npm#6.14.15 at node_modules/npm
npm WARN audit fix jsprim#1.4.1 It cannot be fixed automatically.
npm WARN audit fix jsprim#1.4.1 Check for updates to the npm package.
npm WARN audit fix mkdirp#0.5.1 node_modules/fsevents/node_modules/mkdirp
npm WARN audit fix mkdirp#0.5.1 is a bundled dependency of
npm WARN audit fix mkdirp#0.5.1 fsevents#1.2.9 at node_modules/fsevents
npm WARN audit fix mkdirp#0.5.1 It cannot be fixed automatically.
npm WARN audit fix mkdirp#0.5.1 Check for updates to the fsevents package.
npm WARN audit fix package-json#4.0.1 node_modules/npm/node_modules/package-json
npm WARN audit fix package-json#4.0.1 is a bundled dependency of
npm WARN audit fix package-json#4.0.1 npm#6.14.15 at node_modules/npm
npm WARN audit fix package-json#4.0.1 It cannot be fixed automatically.
npm WARN audit fix package-json#4.0.1 Check for updates to the npm package.
npm WARN audit fix latest-version#3.1.0 node_modules/npm/node_modules/latest-version
npm WARN audit fix latest-version#3.1.0 is a bundled dependency of
npm WARN audit fix latest-version#3.1.0 npm#6.14.15 at node_modules/npm
npm WARN audit fix latest-version#3.1.0 It cannot be fixed automatically.
npm WARN audit fix latest-version#3.1.0 Check for updates to the npm package.
npm WARN audit fix update-notifier#2.5.0 node_modules/npm/node_modules/update-notifier
npm WARN audit fix update-notifier#2.5.0 is a bundled dependency of
npm WARN audit fix update-notifier#2.5.0 npm#6.14.15 at node_modules/npm
npm WARN audit fix update-notifier#2.5.0 It cannot be fixed automatically.
npm WARN audit fix update-notifier#2.5.0 Check for updates to the npm package.
npm WARN audit fix libnpx#10.2.4 node_modules/npm/node_modules/libnpx
npm WARN audit fix libnpx#10.2.4 is a bundled dependency of
npm WARN audit fix libnpx#10.2.4 npm#6.14.15 at node_modules/npm
npm WARN audit fix libnpx#10.2.4 It cannot be fixed automatically.
npm WARN audit fix libnpx#10.2.4 Check for updates to the npm package.
npm WARN audit No fix available for wintersmith#*
npm WARN audit No fix available for jstransformer-markdown-it#*
npm WARN audit Updating vinyl-fs to 2.4.1,which is a SemVer major change.
npm WARN audit Updating gulp to 3.9.1,which is a SemVer major change.
npm WARN audit Updating gulp-zip to 4.2.0,which is a SemVer major change.
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: eslint-plugin-mozilla#2.12.3
npm WARN Found: eslint-plugin-prettier#4.0.0
npm WARN node_modules/eslint-plugin-prettier
npm WARN dev eslint-plugin-prettier#"^4.0.0" from the root project
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer eslint-plugin-prettier#"^3.0.0" from eslint-plugin-mozilla#2.12.3
npm WARN node_modules/eslint-plugin-mozilla
npm WARN dev eslint-plugin-mozilla#"^2.12.3" from the root project
npm WARN
npm WARN Conflicting peer dependency: eslint-plugin-prettier#3.4.1
npm WARN node_modules/eslint-plugin-prettier
npm WARN peer eslint-plugin-prettier#"^3.0.0" from eslint-plugin-mozilla#2.12.3
npm WARN node_modules/eslint-plugin-mozilla
npm WARN dev eslint-plugin-mozilla#"^2.12.3" from the root project
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: eslint-plugin-mozilla#2.12.3
npm WARN Found: prettier#2.7.1
npm WARN node_modules/prettier
npm WARN peer prettier#">=2.0.0" from eslint-plugin-prettier#4.0.0
npm WARN node_modules/eslint-plugin-prettier
npm WARN dev eslint-plugin-prettier#"^4.0.0" from the root project
npm WARN 2 more (stylelint-prettier, the root project)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer prettier#"^1.19.1" from eslint-plugin-mozilla#2.12.3
npm WARN node_modules/eslint-plugin-mozilla
npm WARN dev eslint-plugin-mozilla#"^2.12.3" from the root project
npm WARN
npm WARN Conflicting peer dependency: prettier#1.19.1
npm WARN node_modules/prettier
npm WARN peer prettier#"^1.19.1" from eslint-plugin-mozilla#2.12.3
npm WARN node_modules/eslint-plugin-mozilla
npm WARN dev eslint-plugin-mozilla#"^2.12.3" from the root project
npm WARN deprecated fsevents#1.2.9: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated natives#1.1.6: This module relies on Node.js's internals and will break at some point. Do not use it, and update to graceful-fs#4.x.
npm WARN deprecated mkdirp#0.5.4: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated minimatch#2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch#2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs#1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated gulp-util#3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm WARN deprecated minimatch#0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated chokidar#2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated mkdirp#0.3.5: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated coffee-script#1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated highlight.js#9.18.5: Support has ended for 9.x series. Upgrade to #latest
npm WARN deprecated core-js#2.6.9: core-js#<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! path /Users/mike/Dropbox/__Documents/_Apps/_NewApps/pdf.js/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build --update-binary
npm ERR! Failed to execute '/opt/homebrew/Cellar/node/18.4.0/bin/node /opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/Users/mike/Dropbox/__Documents/_Apps/_NewApps/pdf.js/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/mike/Dropbox/__Documents/_Apps/_NewApps/pdf.js/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp#1.0.5
npm ERR! node-pre-gyp info using node#18.4.0 | darwin | arm64
npm ERR! node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.9.3/canvas-v2.9.3-node-v108-darwin-unknown-arm64.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.9.3/canvas-v2.9.3-node-v108-darwin-unknown-arm64.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for canvas#2.9.3 and node#18.4.0 (node-v108 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.9.3/canvas-v2.9.3-node-v108-darwin-unknown-arm64.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#9.0.0
npm ERR! gyp info using node#18.4.0 | darwin | arm64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#9.0.0
npm ERR! gyp info using node#18.4.0 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.8.9 found at "/Applications/Xcode.app/Contents/Developer/usr/bin/python3"
npm ERR! gyp info spawn /Applications/Xcode.app/Contents/Developer/usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/mike/Dropbox/__Documents/_Apps/_NewApps/pdf.js/node_modules/canvas/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/mike/Library/Caches/node-gyp/18.4.0/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/mike/Library/Caches/node-gyp/18.4.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/mike/Library/Caches/node-gyp/18.4.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/mike/Dropbox/__Documents/_Apps/_NewApps/pdf.js/node_modules/canvas',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! Package pixman-1 was not found in the pkg-config search path.
npm ERR! Perhaps you should add the directory containing `pixman-1.pc'
npm ERR! to the PKG_CONFIG_PATH environment variable
npm ERR! No package 'pixman-1' found
npm ERR! gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:261:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:537:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Darwin 21.5.0
npm ERR! gyp ERR! command "/opt/homebrew/Cellar/node/18.4.0/bin/node" "/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--update-binary" "--module=/Users/mike/Dropbox/__Documents/_Apps/_NewApps/pdf.js/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/Users/mike/Dropbox/__Documents/_Apps/_NewApps/pdf.js/node_modules/canvas/build/Release" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v108"
npm ERR! gyp ERR! cwd /Users/mike/Dropbox/__Documents/_Apps/_NewApps/pdf.js/node_modules/canvas
npm ERR! gyp ERR! node -v v18.4.0
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/opt/homebrew/Cellar/node/18.4.0/bin/node /opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/Users/mike/Dropbox/__Documents/_Apps/_NewApps/pdf.js/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/mike/Dropbox/__Documents/_Apps/_NewApps/pdf.js/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/mike/Dropbox/__Documents/_Apps/_NewApps/pdf.js/node_modules/#mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (node:events:537:28)
npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1091:16)
npm ERR! node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm ERR! node-pre-gyp ERR! System Darwin 21.5.0
npm ERR! node-pre-gyp ERR! command "/opt/homebrew/Cellar/node/18.4.0/bin/node" "/Users/mike/Dropbox/__Documents/_Apps/_NewApps/pdf.js/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
npm ERR! node-pre-gyp ERR! cwd /Users/mike/Dropbox/__Documents/_Apps/_NewApps/pdf.js/node_modules/canvas
npm ERR! node-pre-gyp ERR! node -v v18.4.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.5
npm ERR! node-pre-gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mike/.npm/_logs/2022-06-29T06_21_47_463Z-debug-0.log

npm ERR! code EBADPLATFORM when i push project to deploy a GitHub branch

Below error occurs when I push the project to deploy a GitHub branch:
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for fsevents#2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! notsup Valid OS: darwin
npm ERR! notsup Valid Arch: any
npm ERR! notsup Actual OS: linux
npm ERR! notsup Actual Arch: x64
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.SSqKk/_logs/2021-05-22T14_25_47_923Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
**npm ERR! contactKeepar#1.0.0 heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client`**
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the contactKeepar#1.0.0 Heroku-postbuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.SSqKk/_logs/2021-05-22T14_25_47_980Z-debug.log
-----> Build failed
*****heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client`*****
delete package-lock.json (and node_modules)
npm install
push new package-lock.json to GitHub
and it should work 🎉

Regarding Reactstrap installation

when I'm trying to install react strap using this command but not able to install the reactstrap.
npm install reactstrap --save
that time i'm getting this error
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: react#17.0.1
npm WARN node_modules/react
npm WARN peer react#"*" from #testing-library/react#11.2.2
npm WARN node_modules/#testing-library/react
npm WARN #testing-library/react#"^11.2.2" from the root project
npm WARN 4 more (react-dom, react-popper, the root project, reactstrap)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react#"0.14.x || ^15.0.0 || ^16.0.0" from react-popper#1.3.7
npm WARN node_modules/reactstrap/node_modules/react-popper
npm WARN react-popper#"^1.3.6" from reactstrap#8.8.0
npm WARN node_modules/reactstrap
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: react#17.0.1
npm ERR! node_modules/react
npm ERR! peer react#"*" from #testing-library/react#11.2.2
npm ERR! node_modules/#testing-library/react
npm ERR! #testing-library/react#"^11.2.2" from the root project
npm ERR! peer react#"17.0.1" from react-dom#17.0.1
npm ERR! node_modules/react-dom
npm ERR! peer react-dom#"*" from #testing-library/react#11.2.2
npm ERR! node_modules/#testing-library/react
npm ERR! #testing-library/react#"^11.2.2" from the root project
npm ERR! react-dom#"^17.0.1" from the root project
npm ERR! 1 more (reactstrap)
npm ERR! 3 more (react-popper, the root project, reactstrap)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^0.14.0 || ^15.0.0 || ^16.0.0" from create-react-context#0.3.0
npm ERR! node_modules/reactstrap/node_modules/create-react-context
npm ERR! create-react-context#"^0.3.0" from react-popper#1.3.7
npm ERR! node_modules/reactstrap/node_modules/react-popper
npm ERR! react-popper#"^1.3.6" from reactstrap#8.8.0
npm ERR! node_modules/reactstrap
npm ERR! reactstrap#"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\prajjkum\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\prajjkum\AppData\Local\npm-cache\_logs\2020-12-26T11_13_07_327Z-debug.log
So how to resolve this error please help me... I have tried to uninstall and then again install but it it not working anymore so i'm posted it here
The problem here definitely seems to be with npm 7.
Unfortunately, I am not getting the error with your setup, but only the warnings and I don't know why.
If the issue is indeed with npm, I can suggest two things :
npm install --save reactstrap --legacy-peer-deps and
npx -p npm#6 npm install.
Before proceeding with any step, ensure that you delete node_modules and package-lock.json

Nodemon installation problem using npm commands

While I am trying to install nodemon module using the command
npm install -g nodemon
npm install nodmeon --save
it is giving an error
C:\Users\gourav>npm install -g nodemon
'CALL "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\\node_modules\npm\bin\npm-cli.js" prefix -g' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\gourav\AppData\Roaming\npm\nodemon -> C:\Users\gourav\AppData\Roaming\npm\node_modules\nodemon\bin\nodemon.js
> nodemon#1.18.10 postinstall C:\Users\gourav\AppData\Roaming\npm\node_modules\nodemon
> node bin/postinstall || exit 0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.7 (node_modules\nodemon\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! file C:\WINDOWS\system32\cmd.exe;
npm ERR! path C:\WINDOWS\system32\cmd.exe;
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn C:\WINDOWS\system32\cmd.exe;
npm ERR! nodemon#1.18.10 postinstall: `node bin/postinstall || exit 0`
npm ERR! spawn C:\WINDOWS\system32\cmd.exe; ENOENT
npm ERR!
npm ERR! Failed at the nodemon#1.18.10 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\gourav\AppData\Roaming\npm-cache\_logs\2019-03-23T17_48_14_331Z-debug.log

Yeoman Javascript error involving 'mkdir'

I'm setting up a Meanjs instance with a Yeoman generator. When I do 'sudo yo meanjs' everything works fine until it looks like it is trying to make a directory and it fails, any ideas on what is going on here?
SOLINK_MODULE(target) Release/kerberos.node: Finished
> bson#0.2.5 install /Users/xxx/Documents/mean/node_modules/connect-
mongo/node_modules/mongodb/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)
CXX(target) Release/obj.target/bson/ext/bson.o
SOLINK_MODULE(target) Release/bson.node
SOLINK_MODULE(target) Release/bson.node: Finished
npm ERR! Error: EACCES, mkdir '/Users/xxx/.npm/uglify-js/2.4.15'
npm ERR! { [Error: EACCES, mkdir '/Users/xxx/.npm/uglify-js/2.4.15']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/Users/xxx/.npm/uglify-js/2.4.15',
npm ERR! parent: 'grunt-contrib-uglify' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 13.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/xxx/Documents/mean
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! path /Users/xxx/.npm/uglify-js/2.4.15
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/Users/xxx/.npm/uglify-js/2.4.15'
npm ERR! not ok code 0
That is a pretty common error.
Yeoman is running the following:
bower install & npm install
Bower install succeeded, however NPM install is failing because of user permissions. Just run:
sudo npm install
The ZenCoder's answer is spot on, but if you want to permanently fix this permissions error, you can follow the tutorial at: https://docs.npmjs.com/getting-started/fixing-npm-permissions
Since you're on a Mac, you could actually avoid npm permissions errors altogether by just installing node instead via homebrew:
brew install node (this will install npm too)
Homebrew installs programs to a directory that doesn't require sudo for write, so you can npm install -g <whatever> freely without it.

Categories

Resources