gpt4 book ai didi

node.js - 尝试将 bcrypt 安装到 Node 项目 + Node 设置问题

转载 作者:IT老高 更新时间:2023-10-28 22:12:55 27 4
gpt4 key购买 nike

我看到了一些非常相似的问题,但我发现没有一个似乎有效。我正在尝试 npm install bcrypt 但我不断收到以下错误。

bycrypt 是我用来安装 bcrypt 模块的命令。我确实有 Xcode,安装 node-gyp 似乎没有什么不同

regan@the-Voyagur buddha-bar (feature/styles) $ npm install --save bcrypt
npm WARN package.json mongo@0.1.0 No repository field.
npm WARN package.json mongo@0.1.0 No README data
-
> bcrypt@0.8.0 install /Users/regan/lighthouse/buddha-bar/node_modules/bcrypt
> node-gyp rebuild

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:343:16)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:810:12)
gyp ERR! System Darwin 14.0.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/regan/lighthouse/buddha-bar/node_modules/bcrypt
gyp ERR! node -v v0.10.33
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok

npm ERR! bcrypt@0.8.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt@0.8.0 install script.
npm ERR! This is most likely a problem with the bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls bcrypt
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 14.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "--save" "bcrypt"
npm ERR! cwd /Users/regan/lighthouse/buddha-bar
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0
regan@the-Voyagur buddha-bar (feature/styles) $ xcode-select --print-path
/Library/Developer/CommandLineTools

最佳答案

OP 设法自己解决了这个问题:


sudo xcode-select -switch/Applications/Xcode.app/Contents/Developer/

不过还是很客气地接受了我的回答。

原答案如下:

这里有两个明显的问题。一是您的 node 稍微过时了,而您的 npm 基本上过时了。

您使用的是 OSX,因此有许多流行的方法来管理不同的 Node 版本。这是更新 Node 的指南https://github.com/npm/npm/wiki/Troubleshooting#updating-node-on-osx

然后你要更新到最新的npm:

npm install -g npm@latest

最后,看起来虽然您安装了 XCode,但还是有问题。您报告此命令产生

$ xcode-select --print-path
/Library/Developer/CommandLineTools

在我的 OSX/Yosemite 系统上,可以构建原生插件模块,我明白了

$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer

您可能需要将您的 xcode 路径切换到不同的目录。不过,对于初学者,请更新到当前的 nodenpm 工具并再次尝试安装;如果它仍然失败,接下来要尝试的最危险的事情是

xcode-select --install

如果这些都不能解决问题,请告诉我,我会尽力提供进一步帮助。

关于node.js - 尝试将 bcrypt 安装到 Node 项目 + Node 设置问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27665426/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com