【问题标题】:"CL.exe" exited with code -1073741511, for 'npm install bcrypt --save"“CL.exe”以代码 -1073741511 退出,用于“npm install bcrypt --save”
【发布时间】:2016-10-02 10:04:22
【问题描述】:

我正在阅读 HAPI js 教程身份验证部分 (http://hapijs.com/tutorials/auth?lang=en_US),它需要“bcrypt”。所以我做了“npm install bcrypt --save”。但这会导致 node-gyp 错误,例如缺少 php。所以我按照这里给出的说明进行操作: 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

【问题讨论】:

    标签: node.js npm bcrypt hapijs node-gyp


    【解决方案1】:

    错误代码 -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 世界的方式。许多做一件事的小包(据说做得很好,尽管情况并非总是如此)......

    【讨论】:

    • 那么我需要安装哪个DLL?
    • 我无法确定——我只能猜测您的 Visual Studio 安装以某种方式被破坏了。但是,如果您安装了 github.com/felixrieseberg/windows-build-tools 您的 npm/gyp 没有使用它们,因为您发布的日志中的路径不引用 .windows-build-tools...
    • 好的.. 谢谢。那么我如何让我的 npm/gyp 使用它们呢?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-15
    • 1970-01-01
    • 2019-10-31
    • 1970-01-01
    相关资源
    最近更新 更多