最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

为什么有时候NPM安装不工作在Mac?

运维笔记admin9浏览0评论

为什么有时候NPM安装不工作在Mac?

为什么有时候NPM安装不工作在Mac?

我有项目的NodeJS创建时我运行命令NPM安装它与某些错误而失败

同样的项目正在Ubuntu系统上,但是当我克隆MAC系统上的代码,并尝试运行故宫安装了一些错误而失败

我认为有一些与scrypt模块,但我do't知道原因究竟请帮助我,在此先感谢

操作系统:Mac 节点:10.15 海拔:6.0

请参阅下面的错误: -

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.
回答如下:

我把它通过删除`包lock.json”文件,.npm文件解决,node_modules文件和清洗NPM缓存

所需的步骤:

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

在NPM安装.staging问题,当你运行NPM安装,它会创建node_modules文件夹,但所有模块进入一个子文件夹名为.staging

发布评论

评论列表(0)

  1. 暂无评论