Windows 7上的Yeoman安装问题

时间:2014-06-27 15:59:47

标签: yeoman

为什么Yeoman需要.NET?

C:\windows\system32>npm install -g yo

fullname-native@0.1.1 install C:\Users\me\AppData\Roaming\npm\node_modules\yo\node_modules\fullname\node_modules\fullname-native
node-gyp rebuild

C:\Users\me\AppData\Roaming\npm\node_modules\yo\node_modules\fullname\node_modules\fullname-native>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere.  [C:\Users\me\AppData\Roaming\npm\node_modules\yo\node_modules\fullname\node_modules\fullname-native\build\binding.sln]
gyp ERR! build error
stack Error: `C:\windows\Microsoft.NET\Framework\v4.0.30319\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:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:809:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\me\AppData\Roaming\npm\node_modules\yo\node_modules\fullname\node_modules\fullname-native
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.13.1
gyp ERR! not ok
npm WARN optional dep failed, continuing fullname-native@0.1.1
C:\Users\me\AppData\Roaming\npm\yo -> C:\Users\me\AppData\Roaming\npm\node_modules\yo\cli.js

所以我安装了.NET 2.0并将vcbuild.exe添加到路径

C:\Program Files (x86)\Microsoft Visual Studio 8\VC\vcpackages

但现在我正在打击:

npm install -g yo

fullname-native@0.1.1 install C:\Users\me\AppData\Roaming\npm\node_modules\yo\node_modules\fullname\node_modules\fullname-native
node-gyp rebuild


    C:\Users\me\AppData\Roaming\npm\node_modules\yo\node_modules\fullname\node_modules\fullname-native>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
    Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
    ..\binding.cc(2): fatal error C1083: Cannot open include file: 'iostream': No such file or directory [C:\Users\me\AppData\Roaming\npm\node_modules\yo\node_modules\fullname\node_modules\fullname-native\build\binding.sln]
    gyp ERR! build error
    gyp ERR! stack Error: `C:\windows\Microsoft.NET\Framework\v4.0.30319\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:267:23)
    gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
    gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:809:12)
    gyp ERR! System Windows_NT 6.1.7601
    gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
    gyp ERR! cwd C:\Users\me\AppData\Roaming\npm\node_modules\yo\node_modules\fullname\node_modules\fullname-native
    gyp ERR! node -v v0.10.29
    gyp ERR! node-gyp -v v0.13.1
    gyp ERR! not ok
    npm WARN optional dep failed, continuing fullname-native@0.1.1

1 个答案:

答案 0 :(得分:0)

我自己刚刚解决了这个类似的问题,并认为我会去寻找有人询问它的人。您需要做的是安装Visual Studio 2012或2013.如果您无法安装.NET SDK,但我发现我需要Visual Studio才能使用它。

.NET SDK here

我不是专家,但据我所知,在某些使用node-gyp的生成器中有各种模块,然后使用本机c ++编译器进行构建。这在Windows的标准版本中不存在,您需要安装SDK或Visual Studio才能获得它们。 (这就是我理论上的问题btw)。

为了更好的衡量,我会安装Visual Studio 2012或13以及.NET SDK。此时我发现Visual Studio 2015对我不起作用,我不得不卸载并安装2013 ..

希望有所帮助!