Failed at the core-js postinstall script error - node.js

I am facing the following errors when I try to install node modules in an existing Angular project. I am trying to install the node modules in windows machine(Win32 X64).
> core-js#2.6.12 postinstall node_modules\babel-runtime\node_modules\core-js
> node -e "try{require('-/postinstall')}catch(e){}"
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\ng-cli-pug-loader\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted ("os":"darwin","arch":"any") (current: {"as":"vin3
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\#angular\compiler-cli\node_modules\fsevents): arch":"x64"})
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted ("os": "darwin","arch":"any") (current: {"as":"u ","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.3.2: wanted ("os": "darwin","arch":"any") (current: {"as":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn bash
npm ERR! file bash
npm ERR! path bash
npm ERR! errno -4058
npm ERR! core-js#3.6.4 postinstall: "node -e "try(require('./postinstall')}catch(e){}"
npm ERR! spawn bash ENOENT
npm ERR!
npm ERR! Failed at the core-js#3.6.4 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\test\AppData\Roaming\npm-cache\_logs\2021-06-23T16_43_06_961Z-debug.log
The following are the versions installed in my system
AngularCli : 8.3.29
Node : 14.17.1
NPM: 8.2.12
I have tried deleting node modules folder and running npm cache clean --force and reinstalling node modules , also tried uninstalling nodejs and deleting the npm-cache folder and reinstalling again.
Still I am facing the same issue. Any help would be appreciated.

This error means that the postinstall script is fork-and-exec'ing bash, which is not present on Windows. You need to run this from a Bash emulator like MINGW64 (Git Bash).

Related

Why won't npm i complete the install? Why is it telling node and npm are invalid commands?

Trying to run a React project. I have installed the most recent node as well as tried older versions based on the readme. I've uninstalled Node, cleared all traces of it from APPDATA/ROAMING and ProgramFiles then reinstalled. Colleagues have various versions of Node and npm on their machines and are able to run the project locally. I have checked my environment variables and made sure the PATH properties are set correctly. I have removed this particular package from the JSON file and retried and see similar issues. Node and npm are clearly installed. Anyone ever faced this situation or have suggestions to try? I've been working at this for days! Thanks.
PS C:\dev\NAE\become-react-app> node --version
v14.16.0
PS C:\dev\NAE\become-react-app> npm -v
6.14.11
PS C:\dev\NAE\become-react-app> npm i
> #newrelic/native-metrics#5.0.0 install C:\dev\NAE\become-react-app\node_modules\#newrelic\native-metrics
> node ./lib/pre-build.js install native_metrics
'node' is not recognized as an internal or external command,
operable program or batch file.
> husky#4.2.3 install C:\dev\NAE\become-react-app\node_modules\husky
> node husky install
'node' is not recognized as an internal or external command,
operable program or batch file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.1.2 (node_modules\react-scripts\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.3.2 (node_modules\react-scripts\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.1.2 (node_modules\nodemon\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.11 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: #newrelic/native-metrics#5.0.0 (node_modules\#newrelic\native-metrics):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: #newrelic/native-metrics#5.0.0 install: `node ./lib/pre-build.js install native_metrics`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! husky#4.2.3 install: `node husky install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the husky#4.2.3 install 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\ngmoscho\AppData\Roaming\npm-cache\_logs\2021-03-18T21_32_55_714Z-debug.log
PS C:\dev\NAE\become-react-app> npm run start:local
> become-react-app#1.1.0 prestart:local C:\dev\NAE\become-react-app
> npm run makeLocalEnv
'npm' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! become-react-app#1.1.0 prestart:local: `npm run makeLocalEnv`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the become-react-app#1.1.0 prestart:local 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\ngmoscho\AppData\Roaming\npm-cache\_logs\2021-03-18T22_08_46_897Z-debug.log
I would try to reinstall Node again!
I had it once where it seemed to be installed, but wasn't when executing a command. Just like you. Even after reinstalling npm and node, the result was the same.
I rebooted my computer and that fixed the problem for me.
Pretty lame solution, took me a while to find out.
Hope this helps for you too.

Npm install on cpanel server for Vue Nuxt application is not working?

I am trying to run npm install in the cpanel terminal for a project but it gives me errors.
Firstly I enter the virtual environment in the cpanel terminal as described by cpanel when you create a node application with the interface. I write the command "source /home/mywebhotel/nodevenv/mydomain.com/10/bin/activate && cd /home/mywebhotel/mydomain.com"
Then I check that node is installed which it is.
I have already added a package.json file for my Vue/Nuxt application and I then run npm install and it gives me the following:
> fibers#4.0.3 install /home/mywebhotel/nodevenv/mydomain.com/10/lib/node_modules/fibers
> node build.js || nodejs build.js
`linux-x64-64-glibc` exists; testing
Problem with the binary; manual build incoming
make: Entering directory `/home/mywebhotel/nodevenv/mydomain.com/10/lib/node_modules/fibers/build'
CXX(target) Release/obj.target/fibers/src/fibers.o
make: execvp: g++: Permission denied
make: *** [Release/obj.target/fibers/src/fibers.o] Error 127
make: Leaving directory `/home/mywebhotel/nodevenv/mydomain.com/10/lib/node_modules/fibers/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/opt/alt/alt-nodejs10/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/lib/build.js:191:23)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 3.10.0-962.3.2.lve1.5.35.el7.x86_64
gyp ERR! command "/opt/alt/alt-nodejs10/root/usr/bin/node" "/opt/alt/alt-nodejs10/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /home/mywebhotel/nodevenv/mydomain.com/10/lib/node_modules/fibers
gyp ERR! node -v v10.20.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: `sudo apt-get install g++ build-essential`
RHEL users please run: `yum install gcc-c++` and `yum groupinstall 'Development Tools'`
Alpine users please run: `sudo apk add python make g++`
sh: nodejs: command not found
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#~2.1.2 (node_modules/chokidar/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 WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.7 (node_modules/watchpack-chokidar2/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.7 (node_modules/#babel/cli/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.7 (node_modules/nodemon/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN babel-eslint#10.1.0 requires a peer of eslint#>= 4.12.1 but none is installed. You must install peer dependencies yourself.
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! fibers#4.0.3 install: `node build.js || nodejs build.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the fibers#4.0.3 install 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! /home/mywebhotel/.npm/_logs/2020-07-20T14_32_17_650Z-debug.log
If I try and write sudo npm install it states: bash: sudo: command not found
I hope someone can help! :)
npm install -g node-gyp
npm install --production windows-build-tools
export npm_config_node_gyp=/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js
rm -rf node_modules(if already there)
npm install
Try the above commands and check whether it's works or not.

sh: 1: node-gyp-build: Permission denied and npm ERR! code ELIFECYCLE npm ERR! errno 126

Tried to run this on Ubuntu 18.04 x64. It used to work properly a day ago but it stopped out of nowhere.
npm i simple-youtube-api
I used to be able to install them but not anyone, im getting this:
> bufferutil#4.0.1 install /root/NezukoBot/node_modules/bufferutil
> node-gyp-build
sh: 1: node-gyp-build: Permission denied
npm WARN discord.js#11.5.1 requires a peer of #discordjs/uws#^10.149.0 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js-commando#0.10.0 requires a peer of sqlite#^2.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.1.3 (node_modules/pm2/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 WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.1.3 (node_modules/mocha/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 WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.12 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! bufferutil#4.0.1 install: `node-gyp-build`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the bufferutil#4.0.1 install 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-07-02T12_58_27_816Z-debug.log
I have tried this but i still get the error:
npm config set user 0
npm config set unsafe-perm true
NPM is careful when installing packages as root.
Installing global packages as root or sudo can potentially damage your operating system, as it may accidentally replace files critical to the operating system itself.
However if you still want to proceed, you know what you are doing and you are e.g. using a virtual machine, you can do.
npm install --unsafe-perm -g simple-youtube-api
See unsafe-perm documentation.
Just try to run the command under a user other than root.
https://timjrobinson.com/fixing-node-gyp-permission-denied-when-running-as-root/

Angular 7 CLI installation Issue

Am trying to install Angular CLI 7.1.4 in windows 10.
npm install -g #angular/cli#7.1.4
But am getting below error
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.2 (node_modules#angular\cli\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ERR_INVALID_OPT_VALUE
npm ERR! The value "false" is invalid for option "readableHighWaterMark"
npm ERR! A complete log of this run can be found in:
Please help me to fix this issue.
Node Version:
v10.16.3
NPM Version:
6.9.0

npm errors when installing react-paypal-button

I'm trying to install react-paypal-button for a project that I'm working on
but when I do npm install react-paypal-button#2.0.3 I end up getting this error
C:\Users\ryan1\Downloads\Capstone\Ovals>npm install react-paypal-button#2.0.3
> react-paypal-button#2.0.3 preinstall
C:\Users\ryan1\Downloads\Capstone\Ovals\node_modules\react-paypal-button
> rm -rf dist
'rm' is not recognized as an internal or external command,
operable program or batch file.
npm WARN rollback Rolling back readable-stream#2.3.6 failed (this is probably harmless): EPERM: operation not permitted, lstat 'C:\Users\ryan1\Downloads\Capstone\Ovals\node_modules\chokidar\node_modules\fsevents\node_modules'
npm WARN ajv-keywords#3.4.0 requires a peer of ajv#^6.9.1 but none is installed. You must install peer dependencies yourself.
npm WARN react-async-script-loader#0.3.0 requires a peer of react#^15.5.4 but none is installed. You must install peer dependencies yourself.
npm WARN ts-pnp#1.0.1 requires a peer of typescript#* but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.7 (node_modules\chokidar\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! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-paypal-button#2.0.3 preinstall: `rm -rf dist`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-paypal-button#2.0.3 preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional
logging output above.
If anyone know how to fix it it would be a great helpenter code here
The issue is with this command: rm -rf dist.
'rm' is not recognized as an internal or external command
Follow this link to install react-paypal-button.
Also have a look on this as well dist-tag rm

Resources