Windows 7 上的 Yeoman 安装问题

标签 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

最佳答案

我自己刚刚解决了这个类似的问题,我想我会去寻找询问这个问题的人。您需要做的是安装 Visual Studio 2012 或 2013。如果失败,您可以安装 .NET SDK,但我发现我需要 Visual Studio 才能工作。

.NET SDK here

我不是专家,但据我了解,某些生成器中有各种模块使用 node-gyp,然后使用 native c++ 编译器进行构建。标准 Windows 版本中不存在此功能,您需要安装 SDK 或 Visual Studio 才能获取它们。 (顺便说一句,这就是我的理论问题)。

为了更好地衡量,我会安装 Visual Studio 2012 或 13 以及 .NET SDK。此时我发现 Visual Studio 2015 不适合我,我必须卸载并安装 2013..

希望有帮助!

关于Windows 7 上的 Yeoman 安装问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24456124/

相关文章:

css - Grunt 构建不会创建 css 文件

css - Yeoman 生成的 webapp 元素中 dist 文件夹中的空 css 文件

javascript - Yeoman - 当前使用 AngularJS 和 Express 的最佳方式?

javascript - Grunt/Yeoman 用绝对路径连接 javascript 文件

javascript - 如何使用 grunt 运行 php 文件?

yeoman 。文件名、目录名或卷标语法不正确

vim - .net core 命令不为 omnisharp 生成解决方案文件

angularjs - npm install - Windows 中的 g generator-gulp-angular 错误

node.js - mem-fs-编辑器 : How to copy relative symlinks?

angularjs - 向 yeoman Angular-fullstack 项目添加新的依赖项