Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
485 views
in Technique[技术] by (71.8m points)

npm - Error compiling bcrypt - node.js

I'm trying to install bycrpt via npm install using Windows 7 Ultimate x64. This is my install log:

D:DropboxProjekteRZFinance-Man-GUI
ode_modulescrypt>node "C:Program File
s
odejs
ode_modules
pmin
ode-gyp-bin\....
ode_modules
ode-gypin
ode
-gyp.js" rebuild
npm http GET https://registry.npmjs.org/mime/1.2.6
npm http 304 https://registry.npmjs.org/coffee-script
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/cssom
npm http 304 https://registry.npmjs.org/hooks/0.2.1
npm http 304 https://registry.npmjs.org/mongodb/1.2.8
npm http 304 https://registry.npmjs.org/ms/0.1.0
npm http 304 https://registry.npmjs.org/sliced/0.0.3
npm http 304 https://registry.npmjs.org/muri/0.1.0
npm http 304 https://registry.npmjs.org/mime/1.2.6
npm http GET https://registry.npmjs.org/crc/0.2.0
npm http GET https://registry.npmjs.org/pause/0.0.1
npm http GET https://registry.npmjs.org/bytes/0.1.0
npm http GET https://registry.npmjs.org/formidable/1.0.11
npm http GET https://registry.npmjs.org/qs/0.5.1
npm http GET https://registry.npmjs.org/bson/0.1.5
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0Microsoft.CppBuild.targets(29
7,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.
  TargetFrameworkVersion or PlatformToolset may be set to an invalid version nu
mber. [D:DropboxProjekteRZFinance-Man-GUI
ode_modulescryptuildcrypt_
lib.vcxproj]
  blowfish.cc
  bcrypt.cc
  bcrypt_node.cc
..srccrypt.cc(232): warning C4267: '=' : conversion from 'size_t' to 'unsign
ed char', possible loss of data [D:DropboxProjekteRZFinance-Man-GUI
ode_mo
dulescryptuildcrypt_lib.vcxproj]
c:usersimd.node-gyp.8.18depsuvincludeares.h(49): fatal error C1083: C
annot open include file: 'winsock2.h': No such file or directory [D:DropboxPr
ojekteRZFinance-Man-GUI
ode_modulescryptuildcrypt_lib.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:WindowsMicrosoft.NETFramework64v4.0.30319msbuild.e
xe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:Program Files
odejs
ode_modules
npm
ode_modules
ode-gyplibuild.js:255:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:99:17)
gyp ERR! stack     at Process._handle.onexit (child_process.js:678:10)
gyp ERR! System Windows_NT 6.1.7600
gyp ERR! command "node" "C:\Program Files\nodejs\node_modules\npm\node_modu
les\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd D:DropboxProjekteRZFinance-Man-GUI
ode_modulescrypt
gyp ERR! node -v v0.8.18
gyp ERR! node-gyp -v v0.8.2
gyp ERR! not ok
npm ERR! bcrypt@0.7.3 install: `node-gyp rebuild`
npm ERR! `cmd "/c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the bcrypt@0.7.3 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 Windows_NT 6.1.7600
npm ERR! command "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nod
ejs\node_modules\npm\bin\npm-cli.js" "install"
npm ERR! cwd D:DropboxProjekteRZFinance-Man-GUI
npm ERR! node -v v0.8.18
npm ERR! npm -v 1.2.2
npm ERR! code ELIFECYCLE
npm http 304 https://registry.npmjs.org/crc/0.2.0
npm http 304 https://registry.npmjs.org/qs/0.5.1
npm http 304 https://registry.npmjs.org/pause/0.0.1
npm http 304 https://registry.npmjs.org/bson/0.1.5
npm http 304 https://registry.npmjs.org/formidable/1.0.11
npm http 304 https://registry.npmjs.org/bytes/0.1.0

> bson@0.1.5 install D:DropboxProjekteRZFinance-Man-GUI
ode_modulesmongoos
e
ode_modulesmongodb
ode_modulesson
> node install.js || (exit 0)

================================================================================

=                                                                              =

=  Attempting to build bson c++ extension                                      =

=   Windows: no build will be attempted as binaries are prepackaged            =

=   Unix: on failure the package will still install without the C++ extension  =

=                                                                              =

================================================================================

npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     D:DropboxProjekteRZFinance-Man-GUI
pm-debug.log
npm ERR! not ok code 0

I've already installed Python < v2.7 and .NET Framework SDK 2.0. I also downloaded a package called win7sdkx64.exe which was what i think the sdk for Visual Studio. I liked all of the dependencies in my Path as following:

%SystemRoot%system32;%SystemRoot%;%SystemRoot%System32Wbem;%SYSTEMROOT%System32WindowsPowerShellv1.0;C:Program Files
odejs;E:Program FilesJavajdk1.6.0_38in;C:Program Files (x86)Herokuin;C:Program Files (x86)
uby-1.9.2in;C:Program Files (x86)gitin;C:Program Files (x86)gitcmd;E:Program Files (x86)Herokuin;C:mongodb-win32-x86_64-2.2.2in;E:xamppmysqlin;E:xamppapachein;E:Python27;C:Program Files (x86)Microsoft Visual Studio 8VCvcpackages;C:Program FilesMicrosoft Windows Performance Toolkit;E:Program Files (x86)openssl-0.9.8k_X64in

but i still get these errors. What can i try next? Install Visual Studio completly?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Ditch the bcrypt module and use a native JavaScript library instead. bcrypt-nodejs requires no compilation and provides almost the same functionality as the compiled bcrypt.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...