无法在Windows 10上安装mongoose

PS E:\Selvam\Prepare Myself\NodeJs\module3\start> npm install mongoose --save - > kerberos@0.0.15 install E:\Selvam\Prepare Myself\NodeJs\module3\start\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\node_modules\kerberos > (node-gyp rebuild) || (exit 0) E:\Selvam\Prepare Myself\NodeJs\module3\start\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\node_modules\kerberos>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 ) Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(366,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry. TargetFrameworkVersion or PlatformToolset may be set to an invalid version number. [E:\Selvam\Prepare Myself\NodeJs\module3\start\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\node_modules\kerbe ros\build\kerberos.vcxproj] TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified. [E:\Selvam\Prepare Myself\NodeJs\module3\start\node_modules\mongoose\node_modules\mongodb\node_ modules\mongodb-core\node_modules\kerberos\build\kerberos.vcxproj] gyp ERR! build error gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:270:23) gyp ERR! stack at emitTwo (events.js:87:13) gyp ERR! stack at ChildProcess.emit (events.js:172:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) gyp ERR! System Windows_NT 10.0.10240 gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" gyp ERR! cwd E:\Selvam\Prepare Myself\NodeJs\module3\start\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\node_modules\kerberos gyp ERR! node -v v4.1.1 gyp ERR! node-gyp -v v3.0.3 gyp ERR! not ok mongoose@4.1.10 node_modules\mongoose ├── hooks-fixed@1.1.0 ├── async@0.9.0 ├── mpromise@0.5.4 ├── regexp-clone@0.0.1 ├── mpath@0.1.1 ├── muri@1.0.0 ├── sliced@0.0.5 ├── ms@0.1.0 ├── kareem@1.0.1 ├── bson@0.4.16 ├── mquery@1.6.3 (bluebird@2.9.26) └── mongodb@2.0.42 (es6-promise@2.1.1, readable-stream@1.0.31, mongodb-core@1.2.10) 

我遇到了同样的错误。 安装VS社区2015后,我不得不打开VS并创build一个JavaScript项目。 VS要求我安装更多的软件包。 安装错误后解决。

Could not find WindowsSDKDir variable from the registry.

error TRK0005: Failed to locate: "CL.exe".

 TargetFrameworkVersion or PlatformToolset may be set to an invalid version number. [E:\Selvam\Prepare Myself\NodeJs\module3\start\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\node_modules\kerbe ros\build\kerberos.vcxproj] 

您要么没有安装Visual Studio,您的安装已损坏,或者您的TargetFrameworkVersion或PlatformToolset被设置为无效的版本号。

这对我工作:

 download and install Python 2.7.11 add C:\Python27 and C:\Python27\Scripts to PATH in Environment Variables, remember to separate paths with a semicolon npm install -g cordova npm install mongoose