我正在浏览HAPI js教程身份验证部分(http://hapijs.com/tutorials/auth?lang=en_US),这需要“bcrypt”。所以我做了“npm install bcrypt --save”。但是这给了像php这样的node-gyp错误。所以我按照这里给出的指示: https://github.com/nodejs/node-gyp#installation
我甚至做过:npm install --global --production windows-build-tools
但是现在它正在抛出错误:
“CL.exe”退出,代码为-1073741511
我已安装了他们要求的所有内容,但它不允许安装bcrypt。我该怎么办?
简单的教程练习花了我2天的研究,没有任何解决方案。为什么在教程中使用这种依赖性驱动的包?
这是我正在进行npm install bcrypt的实际控制台日志:
m WARN package.json personal_assistant@1.0.0 No README data
bcrypt@0.8.7 install D:\learn\personal_assistant\server\node_modules\bcrypt
node-gyp rebuild
\learn\personal_assistant\server\node_modules\bcrypt>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\
\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
ilding the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
\Program Files\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" exited with code -1073741511. [D:\learn\personal_
sistant\server\node_modules\bcrypt\build\bcrypt_lib.vcxproj]
p ERR! build error
p ERR! stack Error: `C:\Program Files\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
p ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
p ERR! stack at emitTwo (events.js:87:13)
p ERR! stack at ChildProcess.emit (events.js:172:7)
p ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
p ERR! System Windows_NT 6.1.7600
p ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
p ERR! cwd D:\learn\personal_assistant\server\node_modules\bcrypt
p ERR! node -v v4.5.0
p ERR! node-gyp -v v3.4.0
p ERR! not ok
m ERR! Windows_NT 6.1.7600
m ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "bcrypt" "--save"
m ERR! node v4.5.0
m ERR! npm v2.15.9
m ERR! code ELIFECYCLE
m ERR! bcrypt@0.8.7 install: `node-gyp rebuild`
m ERR! Exit status 1
m ERR!
m ERR! Failed at the bcrypt@0.8.7 install script 'node-gyp rebuild'.
m ERR! This is most likely a problem with the bcrypt package,
m ERR! not with npm itself.
m ERR! Tell the author that this fails on your system:
m ERR! node-gyp rebuild
m ERR! You can get information on how to open an issue for this project with:
m ERR! npm bugs bcrypt
m ERR! Or if that isn't available, you can get their info via:
m ERR!
m ERR! npm owner ls bcrypt
m ERR! There is likely additional logging output above.
m ERR! Please include the following file with any support request:
m ERR! D:\learn\personal_assistant\server\npm-debug.log
答案 0 :(得分:0)
错误代码-1073741511转换为0xC0000139,显然是“未找到DLL”。
这让我觉得你的C ++构建工具链有问题,这是构建bcrypt库的本机位所必需的。
我知道这并没有多大帮助,但它在我的机器上工作:
C:\Users\X\Desktop\xx>npm i --save bcrypt
npm info it worked if it ends with ok
npm info using npm@3.8.6
npm info using node@v6.1.0
npm info ok
npm info it worked if it ends with ok
npm info using npm@3.5.0
npm info using node@v6.1.0
> bcrypt@0.8.7 install C:\Users\X\Desktop\xx\node_modules\bcrypt
> node-gyp rebuild
C:\Users\X\Desktop\xx\node_modules\bcrypt>if not defined npm_config_node_gyp (node "C:\Users\X\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild )
gyp info it worked if it ends with ok
gyp info using node-gyp@3.0.3
gyp info using node@6.1.0 | win32 | x64
gyp http GET https://nodejs.org/download/release/v6.1.0/node-v6.1.0-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v6.1.0/node-v6.1.0-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v6.1.0/SHASUMS256.txt
gyp http GET https://nodejs.org/download/release/v6.1.0/win-x86/node.lib
gyp http GET https://nodejs.org/download/release/v6.1.0/win-x64/node.lib
gyp http 200 https://nodejs.org/download/release/v6.1.0/win-x86/node.lib
gyp http 200 https://nodejs.org/download/release/v6.1.0/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v6.1.0/win-x64/node.lib
gyp info spawn python
gyp info spawn args [ 'C:\\Users\\X\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-G',
gyp info spawn args 'msvs_version=auto',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\X\\Desktop\\xx\\node_modules\\bcrypt\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\X\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\X\\.node-gyp\\6.1.0\\include\\node\\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\\Users\\X\\.node-gyp\\6.1.0',
gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\X\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp',
gyp info spawn args '-Dnode_lib_file=node.lib',
gyp info spawn args '-Dmodule_root_dir=C:\\Users\\X\\Desktop\\xx\\node_modules\\bcrypt',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'C:\\Users\\X\\Desktop\\xx\\node_modules\\bcrypt\\build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info spawn C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
blowfish.cc
bcrypt.cc
bcrypt_node.cc
..\src\bcrypt.cc(232): warning C4267: '=' : conversion from 'size_t' to 'unsigned char', possible loss of data [C:\Users\X\Desktop\xx\node_modules\bcrypt\build\bcrypt_lib.vcxproj]
..\src\bcrypt_node.cc(76): warning C4244: 'argument' : conversion from 'ssize_t' to 'unsigned char', possible loss of data [C:\Users\X\Desktop\xx\node_modules\bcrypt\build\bcrypt_lib .vcxproj]
..\src\bcrypt_node.cc(229): warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data [C:\Users\X\Desktop\xx\node_modules\bcrypt\build\bcrypt_lib.vcxpr oj]
..\src\bcrypt_node.cc(230): warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data [C:\Users\X\Desktop\xx\node_modules\bcrypt\build\bcrypt_lib.vcxpr oj]
win_delay_load_hook.c
Creating library C:\Users\X\Desktop\xx\node_modules\bcrypt\build\Release\bcrypt_lib.lib and object C:\Users\X\Desktop\xx\node_modules\bcrypt\build\Release\bcrypt_lib.exp
Generating code
Finished generating code
bcrypt_lib.vcxproj -> C:\Users\X\Desktop\xx\node_modules\bcrypt\build\Release\\bcrypt_lib.node
gyp info ok
npm info lifecycle bindings@1.2.1~postinstall: bindings@1.2.1
npm info lifecycle nan@2.3.5~postinstall: nan@2.3.5
npm info lifecycle bcrypt@0.8.7~postinstall: bcrypt@0.8.7
npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\X\Desktop\xx\package.json'
C:\Users\X\Desktop\xx
└─┬ bcrypt@0.8.7
├── bindings@1.2.1
└── nan@2.3.5
npm info ok
C:\Users\X\Desktop\xx>
关于你的问题,
为什么在教程中使用这种依赖性驱动的包?
- 这就是Node.js / NPM世界的方式。很多小包装做了一件事(据说做得很好,但情况并非总是这样)......