why sometimes npm install is not working on mac?
Asked Answered
G

2

8

I have created nodejs project when i am running command npm install it is failing with some error

The same project is working on ubuntu system but when i clone this code on mac system and try to run npm install it failed with some error

I think there is something with scrypt module but i do't know the reason exactly Please help me, Thanks in advance

OS: MAC
Node: 10.15
Npm :6.0

See error below :-

WareWolf:mynodeapp$ npm install
> [email protected] preinstall /node_modules/scrypt
> node node-scrypt-preinstall.js

Error: Error: Command failed: ./configure
configure: error: /node_modules/scrypt/scrypt/scrypt-1.2.0':
configure: error: C compiler cannot create executables
See `config.log' for more details

> [email protected] install /node_modules/scrypt
> node-gyp rebuild

gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (/usr/local/Cellar/nvm/0.34.0/versions/node/v10.15.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/usr/local/Cellar/nvm/0.34.0/versions/node/v10.15.0/bin/node" "/usr/local/Cellar/nvm/0.34.0/versions/node/v10.15.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /node_modules/scrypt
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
Gordie answered 12/1, 2019 at 16:17 Comment(4)
Did you “See `config.log' for more details”? What does it say? It's trying to compile a module written in C. Perhaps you need to update Xcode (shot in the dark, I'm not an expert on this)Substituent
Please post config.logMelena
where is config.log?Gordie
npm install worked when i removed node_modules file but i do't know what was the problem => i forgot to put node_modules file in .gitignore file.. earlier i was using ubuntu and when i git clone repo in mac system, tried to run npm install it starts throwing errorGordie
B
16

You will need to remove package-lock.json, .npm and node_modules folder.

Required steps:

npm install npm@latest -g
npm cache clean — force
rm -rf ~/.npm
rm -rf node_modules
rm -f package-lock.json

In npm install .staging issue, When you run npm install, it creates the node_modules folder but all the modules go into a subfolder called .staging

Bordie answered 5/2, 2019 at 18:45 Comment(1)
I get an error: npm error Error: Failed to find Electron v1.8.8 for darwin-arm64 at github.com/electron/electron/releases/download/v1.8.8/…Longerich
E
2

I have found the same issue when I started a project in my linux machine and I like to clone to work on it from a Mac.

Solution working for me:

npm install --no-optional

More info: https://mcmap.net/q/135898/-how-to-solve-npm-install-throwing-fsevents-warning-on-non-mac-os

The other way to solve this, is to remove the package-lock.json.

Econah answered 17/8, 2020 at 15:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.