NPM安装失败,并带有node
我们在项目上运行“ npm install”时遇到问题。找不到某个文件:
fatal error C1083: Cannot open include file: 'windows.h'
似乎来自node-gyp模块:
c:\ Program文件\ nodejs \ node_modules \ npm \ node_modules \ node-gyp \ src \ win_delay_load_hook.c(13):
严重错误C1083:无法打开包含文件:'windows.h':不成功文件或目录[D:\ ngs-frontend-next \ node_modules \ browser-sync \ node_modules \ socket.io \ node_modules \ engine.io \ node_modules \ ws \ node_modules \ bufferutil \ build \ binding.sln]
这个节点石膏似乎给我们带来了无尽的痛苦。最初,它抱怨它需要python,因此我们安装了它。然后它抱怨它需要我们安装的VCBuild(使用.NET 2.0 SDK),现在出现此错误。错误几乎变得越来越模糊,感觉就像我们走了一条错误的路。
奇怪的是,我们团队中的其他人在运行npm-install时零问题。
完整错误看起来像这样:
c:\ Program文件\ nodejs \ node_modules \ npm \ node_modules \ node-gyp \ src \ win_delay_load_hook.c(13):
严重错误C1083:无法打开包含文件:'windows.h':不成功文件或目录[D:\ ngs-frontend-next \ node_modules \ browser-sync \ node_modules \ socket.io \ node_modules \ engine.io \ node_modules \ ws \ node_modules \ bufferutil \ build \ binding.sln]
gyp ERR!生成错误gyp ERR!堆栈错误:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
失败退出代码:在ChildProcess.onExit(C:\ Program文件\ nodejs \ node_modules \ npm \ node_modules \ node-gyp \ lib \ build.js:270:23)gyp错误!堆叠在generateTwo(events.js:87:13)gyp ERR!堆栈在ChildProcess.emit(events.js:172:7)gyp ERR!堆叠在Process.ChildProcess._handle.onexit(internal / child_process.js:200:12)gyp ERR!系统Windows_NT 6.1.7601 gyp ERR!命令“ C:\ Program Files \ nodejs \ node.exe”“ C:\ Program Files \ nodejs \ node_modules \ npm \ node_modules \ node-gyp \ bin \ node-gyp.js““重建”石膏错误!电脑D:\ ngs-frontend-next \ node_modules \ browser-sync \ node_modules \ socket。io \ node_modules \ engine.io \ node_modules \ ws \ node_modules \ bufferutil gyp呃!节点-v v4.2.2 gyp ERR! node-gyp -v v3.0.3 gyp错误!不行npmWARN可选的dep失败,继续[email protected][email protected]安装后D:\ ngs-frontend-next \ node_modules \ gulp-imagemin \ node_modules \ imagemin \ node_modules \ imagemin-gifs \ node_modules \ gifsicle节点lib / install.js
出pacakge.json看起来像这样:
{
"name": "Fast-nunjucks",
"version": "0.0.1",
"description": "A simple boilerplate using nunjucks as a template engine",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": ".git"
},
"keywords": [
"nunjucks",
"node",
"gulp",
"stylus"
],
"author": "Willian Justen de Vasconcellos",
"license": "ISC",
"bugs": {
"url": ""
},
"homepage": "",
"devDependencies": {
"autoprefixer-stylus": "^0.7.1",
"browser-sync": "^2.8.2",
"gulp": "^3.9.0",
"gulp-cache": "^0.3.0",
"gulp-concat": "^2.6.0",
"gulp-if": "^1.2.5",
"gulp-imagemin": "^2.3.0",
"gulp-minify-html": "^1.0.4",
"gulp-nunjucks-html": "^1.2.2",
"gulp-order": "^1.1.1",
"gulp-plumber": "^1.0.1",
"gulp-stylus": "^2.0.6",
"gulp-uglify": "^1.2.0",
"gulp-util": "^3.0.6",
"jeet": "^6.1.2",
"kouto-swiss": "^0.11.13",
"minimist": "^1.1.3",
"rupture": "^0.6.1"
},
"dependencies": {
"gulp-install": "^0.6.0"
}
}
回答如下:错误消息使我感到困惑,并且没有帮助我彻底解决错误。
README.md项目的node-gyp可以更好地列出Unix,Max OS X和Windows的安装说明。
在Windows系统中,可以使用选件1或选件2,但主要是需要安装Visual C++ Build Tools。
以下引文来自Windows安装部分:
- 在Windows上:
- Visual C ++构建环境:
[仅Windows Vista / 7]需要.NET Framework 4.5.1
- 选项1:使用“默认安装”选项安装Visual C ++生成工具。
- 选项2:安装Visual Studio 2015(或修改现有安装),并在安装过程中选择Visual C ++通用工具。这也适用于免费的Community和Express for Desktop版本。
- 安装Python 2.7(不支持v3.x.x),然后运行
(或参阅以下有关指定正确的Python版本和路径的进一步说明。)npm config set python python2.7
- 启动cmd,
npm config set msvs_version 2015
如果上述步骤对您不起作用,请访问Microsoft的Windows Node.js指南以获取更多提示。
Python配置的通用说明:
如果安装了多个Python版本,则可以通过设置'--python'变量来标识node-gyp使用哪个Python版本:
$ node-gyp --python /path/to/python2.7
如果通过npm调用node-gyp并且您安装了多个版本的Python,则可以将npm的'python'配置键设置为适当的值:
$ npm config set python /path/to/executable/python2.7
按照上述说明成功配置了我的系统。
系统信息
λ ver
Microsoft Windows [Version 6.1.7601]
λ node -v
v6.2.0
λ npm -v
3.9.2
到相关工具/文章的链接:
Visual C++ Build Tools
Visual Studio 2015
.NET Framework 4.5.1
Python 2.7
Microsoft's Node.js Guidelines for Windows
NPM安装失败,并带有node
我们在项目上运行“ npm install”时遇到问题。找不到某个文件:
fatal error C1083: Cannot open include file: 'windows.h'
似乎来自node-gyp模块:
c:\ Program文件\ nodejs \ node_modules \ npm \ node_modules \ node-gyp \ src \ win_delay_load_hook.c(13):
严重错误C1083:无法打开包含文件:'windows.h':不成功文件或目录[D:\ ngs-frontend-next \ node_modules \ browser-sync \ node_modules \ socket.io \ node_modules \ engine.io \ node_modules \ ws \ node_modules \ bufferutil \ build \ binding.sln]
这个节点石膏似乎给我们带来了无尽的痛苦。最初,它抱怨它需要python,因此我们安装了它。然后它抱怨它需要我们安装的VCBuild(使用.NET 2.0 SDK),现在出现此错误。错误几乎变得越来越模糊,感觉就像我们走了一条错误的路。
奇怪的是,我们团队中的其他人在运行npm-install时零问题。
完整错误看起来像这样:
c:\ Program文件\ nodejs \ node_modules \ npm \ node_modules \ node-gyp \ src \ win_delay_load_hook.c(13):
严重错误C1083:无法打开包含文件:'windows.h':不成功文件或目录[D:\ ngs-frontend-next \ node_modules \ browser-sync \ node_modules \ socket.io \ node_modules \ engine.io \ node_modules \ ws \ node_modules \ bufferutil \ build \ binding.sln]
gyp ERR!生成错误gyp ERR!堆栈错误:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
失败退出代码:在ChildProcess.onExit(C:\ Program文件\ nodejs \ node_modules \ npm \ node_modules \ node-gyp \ lib \ build.js:270:23)gyp错误!堆叠在generateTwo(events.js:87:13)gyp ERR!堆栈在ChildProcess.emit(events.js:172:7)gyp ERR!堆叠在Process.ChildProcess._handle.onexit(internal / child_process.js:200:12)gyp ERR!系统Windows_NT 6.1.7601 gyp ERR!命令“ C:\ Program Files \ nodejs \ node.exe”“ C:\ Program Files \ nodejs \ node_modules \ npm \ node_modules \ node-gyp \ bin \ node-gyp.js““重建”石膏错误!电脑D:\ ngs-frontend-next \ node_modules \ browser-sync \ node_modules \ socket。io \ node_modules \ engine.io \ node_modules \ ws \ node_modules \ bufferutil gyp呃!节点-v v4.2.2 gyp ERR! node-gyp -v v3.0.3 gyp错误!不行npmWARN可选的dep失败,继续[email protected][email protected]安装后D:\ ngs-frontend-next \ node_modules \ gulp-imagemin \ node_modules \ imagemin \ node_modules \ imagemin-gifs \ node_modules \ gifsicle节点lib / install.js
出pacakge.json看起来像这样:
{
"name": "Fast-nunjucks",
"version": "0.0.1",
"description": "A simple boilerplate using nunjucks as a template engine",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": ".git"
},
"keywords": [
"nunjucks",
"node",
"gulp",
"stylus"
],
"author": "Willian Justen de Vasconcellos",
"license": "ISC",
"bugs": {
"url": ""
},
"homepage": "",
"devDependencies": {
"autoprefixer-stylus": "^0.7.1",
"browser-sync": "^2.8.2",
"gulp": "^3.9.0",
"gulp-cache": "^0.3.0",
"gulp-concat": "^2.6.0",
"gulp-if": "^1.2.5",
"gulp-imagemin": "^2.3.0",
"gulp-minify-html": "^1.0.4",
"gulp-nunjucks-html": "^1.2.2",
"gulp-order": "^1.1.1",
"gulp-plumber": "^1.0.1",
"gulp-stylus": "^2.0.6",
"gulp-uglify": "^1.2.0",
"gulp-util": "^3.0.6",
"jeet": "^6.1.2",
"kouto-swiss": "^0.11.13",
"minimist": "^1.1.3",
"rupture": "^0.6.1"
},
"dependencies": {
"gulp-install": "^0.6.0"
}
}
回答如下:错误消息使我感到困惑,并且没有帮助我彻底解决错误。
README.md项目的node-gyp可以更好地列出Unix,Max OS X和Windows的安装说明。
在Windows系统中,可以使用选件1或选件2,但主要是需要安装Visual C++ Build Tools。
以下引文来自Windows安装部分:
- 在Windows上:
- Visual C ++构建环境:
[仅Windows Vista / 7]需要.NET Framework 4.5.1
- 选项1:使用“默认安装”选项安装Visual C ++生成工具。
- 选项2:安装Visual Studio 2015(或修改现有安装),并在安装过程中选择Visual C ++通用工具。这也适用于免费的Community和Express for Desktop版本。
- 安装Python 2.7(不支持v3.x.x),然后运行
(或参阅以下有关指定正确的Python版本和路径的进一步说明。)npm config set python python2.7
- 启动cmd,
npm config set msvs_version 2015
如果上述步骤对您不起作用,请访问Microsoft的Windows Node.js指南以获取更多提示。
Python配置的通用说明:
如果安装了多个Python版本,则可以通过设置'--python'变量来标识node-gyp使用哪个Python版本:
$ node-gyp --python /path/to/python2.7
如果通过npm调用node-gyp并且您安装了多个版本的Python,则可以将npm的'python'配置键设置为适当的值:
$ npm config set python /path/to/executable/python2.7
按照上述说明成功配置了我的系统。
系统信息
λ ver
Microsoft Windows [Version 6.1.7601]
λ node -v
v6.2.0
λ npm -v
3.9.2
到相关工具/文章的链接:
Visual C++ Build Tools
Visual Studio 2015
.NET Framework 4.5.1
Python 2.7
Microsoft's Node.js Guidelines for Windows