我已经创建了nodejs项目,当我运行命令npm安装时,它出现了一些错误。
同样的项目正在运行于ubuntu系统上,但是当我在mac系统上克隆这段代码并尝试运行npm安装时,它失败了,出现了一些错误。
--我想有一些带有氪星模块的东西,但我不知道确切的原因--请帮助我,谢谢提前
操作系统: MAC
节点: 10.15
国家预防机制:6.0
参见下面的错误:-
WareWolf:mynodeapp$ npm install
> scrypt@6.0.3 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
> scrypt@6.0.3 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! scrypt@6.0.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the scrypt@6.0.3 install script.发布于 2019-02-05 18:45:47
您需要删除package-lock.json、.npm和node_modules文件夹。
所需步骤:
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的子文件夹。
发布于 2020-08-17 15:08:18
当我在我的linux机器上启动一个项目时,我发现了同样的问题,我喜欢在Mac上克隆它。
解决方案适用于我:
npm install --no-optional
更多信息:https://stackoverflow.com/a/47071650/2976796
解决这一问题的另一种方法是删除包-lock.json。
https://stackoverflow.com/questions/54161448
复制相似问题