macOS npm install gypgyp报错 exit code 2

gypgyp  ERR!ERR!  build errorbuild error 

 

gypgyp  ERR!ERR!  stackstack Error: `make` failed with exit code: 2

 

 

 

 

1. 重新install试试

 

rm -rf package-lock.json
rm -rf node_modules

npm cache clear --force

npm install

 

2. Deleting .node-gyp folder

 

rm -rf ~/.node-gyp

npm install

 

3. 重新install gyp

 

npm i -g node-gyp

 

4. Update Node and NPM

 

5. Install build essentials

 

sudo apt-get install -y build-essential

 

sudo apt-get undefined

安装xcode

使用xcode命令行 

xcode-select --install

上述都不能解决问题 应该是node版本不匹配,使用nvm来管理node版本,一个项目应该记录下来使用的node版本为后续开发者使用。


参考 https://codeforgeek.com/make-failed-with-exit-code-2/

猜你喜欢

转载自www.cnblogs.com/xiaozhaoaixuexi/p/11849441.html