windows 7 节点故障
Node failure on windows 7
================================
已解决: 从节点 4.0.0 切换到 0.12.7。 Node v4.0.0 似乎还很原始
我读了很多文章,它们对我没有帮助。有什么解决方法吗?
我已经在我的 Windows 7 上安装了 Visual Studio Express 2013,并且安装了 set GYP_MSVS_VERSION=2013
。但是在 npm install
:
时,我仍然收到与 socket.io
依赖相关的以下错误
error C2995: 'v8::Local<T> _NanEnsureLocal(v8::Local<T>)' : function template
error C3083: 'smalloc': the symbol to the left of a '::' must be a type [
error C2039: 'FreeCallback' : is not a member of 'node' [
error C2061: syntax error : identifier 'FreeCallback' [
error C2065: 'callback' : undeclared identifier [
..............
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild.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 6.1.7601
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 PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil
gyp ERR! node -v v4.0.0
gyp ERR! node-gyp -v v3.0.1
gyp ERR! not ok
完整日志
PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil>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.
bufferutil.cc
PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\node_modules\nan\nan.h(263): error C2995: 'v8::Local<T> _NanEnsureLocal(v8::Local<T>)' : function template has already been defined [PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj]
PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\node_modules\nan\nan.h(256) : see declaration of '_NanEnsureLocal'
PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\node_modules\nan\nan.h(661): error C3083: 'smalloc': the symbol to the left of a '::' must be a type [PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj]
PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\node_modules\nan\nan.h(661): error C2039: 'FreeCallback' : is not a member of 'node' [PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj]
PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\node_modules\nan\nan.h(661): error C2061: syntax error : identifier 'FreeCallback' [PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj]
PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\node_modules\nan\nan.h(665): error C2065: 'callback' : undeclared identifier [PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj]
PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\node_modules\nan\nan.h(665): error C2065: 'hint' : undeclared identifier [PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj]
PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\node_modules\nan\nan.h(672): error C2665: 'node::Buffer::New' : none of the 4 overloads could convert all the argument types [PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj]
C:\Users\VBakhmatiuk\.node-gyp.0.0\include\node\node_buffer.h(43): could be 'v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate *,char *,size_t)'
C:\Users\VBakhmatiuk\.node-gyp.0.0\include\node\node_buffer.h(31): or 'v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate *,v8::Local<v8::String>,node::encoding)'
while trying to match the argument list '(v8::Isolate *, const char *, uint32_t)'
PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\node_modules\nan\nan.h(676): error C2664: 'v8::Local<v8::Object>::Local(const v8::Local<v8::Object> &)' : cannot convert argument 1 from 'v8::MaybeLocal<v8::Object>' to 'const v8::Local<v8::Object> &' [PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj]
Reason: cannot convert from 'v8::MaybeLocal<v8::Object>' to 'const v8::Local<v8::Object>'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\node_modules\nan\nan.h(683): error C2039: 'Use' : is not a member of 'node::Buffer' [PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj]
PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\node_modules\nan\nan.h(683): error C3861: 'Use': identifier not found [PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild.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 6.1.7601
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 PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil
gyp ERR! node -v v4.0.0
gyp ERR! node-gyp -v v3.0.1
gyp ERR! not ok
> utf-8-validate@1.1.0 install PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\utf-8-validate
> node-gyp rebuild
试试这个:
- 安装 visual studio 社区 15
- 执行 msbuild 提示符(visual studio 工具访问菜单)
- 将 MsBuild 程序添加到路径 env:
C:\Program Files (x86)\MSBuild.0\Bin
- 执行
npm config set msvs_version 2015 --global
- 将目录添加到一个较短的位置(有时会失败,因为在 windows os 系统中有 260 个字符的限制)
npm-debug 系统和节点 4 io 集成似乎存在故障。如果您尝试使用生成器,请尝试代码是否已经运行
如果您使用的是发电机
我在 Ubuntu 和 Mac 上遇到过这个问题。回滚到 socket.io 版本 1.3.5 应该可以。
Mac 和 Ubuntu 上的命令是:npm install socket.io@1.3.5.
我不知道Window的命令是什么。
已接受的答案并不清楚真正的解决方案。
我在 Win7 上遇到了完全相同的问题,我不得不完全卸载 Node 4.0.0 并从 https://nodejs.org/dist/v0.12.7/
重新安装 0.12.7
之后,npm install
完美运行。
除了安装适当的 Visual Studio 和 npm 配置外,您可能还需要删除 'node_modules' 目录才能让 'npm install' 再次工作。
这对我有用
Go to System-Properties (run: systempropertiesadvanced.exe), in Advanced tab, click Environment Variables.
Still on the System variables, click 'New', add "NODE_PATH" with value "C:\nodejs64\node_modules", and click OK.
click 'New' again, add "NODE_SKIP_PLATFORM_CHECK" with value "1", and click OK.
Click OK of all dialogs close.
Restart your machine, so explore and cmd will get the fresh set of variables.
================================
已解决: 从节点 4.0.0 切换到 0.12.7。 Node v4.0.0 似乎还很原始
我读了很多文章,它们对我没有帮助。有什么解决方法吗?
我已经在我的 Windows 7 上安装了 Visual Studio Express 2013,并且安装了 set GYP_MSVS_VERSION=2013
。但是在 npm install
:
socket.io
依赖相关的以下错误
error C2995: 'v8::Local<T> _NanEnsureLocal(v8::Local<T>)' : function template
error C3083: 'smalloc': the symbol to the left of a '::' must be a type [
error C2039: 'FreeCallback' : is not a member of 'node' [
error C2061: syntax error : identifier 'FreeCallback' [
error C2065: 'callback' : undeclared identifier [
..............
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild.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 6.1.7601
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 PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil
gyp ERR! node -v v4.0.0
gyp ERR! node-gyp -v v3.0.1
gyp ERR! not ok
完整日志
PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil>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.
bufferutil.cc
PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\node_modules\nan\nan.h(263): error C2995: 'v8::Local<T> _NanEnsureLocal(v8::Local<T>)' : function template has already been defined [PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj]
PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\node_modules\nan\nan.h(256) : see declaration of '_NanEnsureLocal'
PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\node_modules\nan\nan.h(661): error C3083: 'smalloc': the symbol to the left of a '::' must be a type [PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj]
PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\node_modules\nan\nan.h(661): error C2039: 'FreeCallback' : is not a member of 'node' [PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj]
PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\node_modules\nan\nan.h(661): error C2061: syntax error : identifier 'FreeCallback' [PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj]
PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\node_modules\nan\nan.h(665): error C2065: 'callback' : undeclared identifier [PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj]
PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\node_modules\nan\nan.h(665): error C2065: 'hint' : undeclared identifier [PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj]
PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\node_modules\nan\nan.h(672): error C2665: 'node::Buffer::New' : none of the 4 overloads could convert all the argument types [PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj]
C:\Users\VBakhmatiuk\.node-gyp.0.0\include\node\node_buffer.h(43): could be 'v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate *,char *,size_t)'
C:\Users\VBakhmatiuk\.node-gyp.0.0\include\node\node_buffer.h(31): or 'v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate *,v8::Local<v8::String>,node::encoding)'
while trying to match the argument list '(v8::Isolate *, const char *, uint32_t)'
PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\node_modules\nan\nan.h(676): error C2664: 'v8::Local<v8::Object>::Local(const v8::Local<v8::Object> &)' : cannot convert argument 1 from 'v8::MaybeLocal<v8::Object>' to 'const v8::Local<v8::Object> &' [PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj]
Reason: cannot convert from 'v8::MaybeLocal<v8::Object>' to 'const v8::Local<v8::Object>'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\node_modules\nan\nan.h(683): error C2039: 'Use' : is not a member of 'node::Buffer' [PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj]
PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\node_modules\nan\nan.h(683): error C3861: 'Use': identifier not found [PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild.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 6.1.7601
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 PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil
gyp ERR! node -v v4.0.0
gyp ERR! node-gyp -v v3.0.1
gyp ERR! not ok
> utf-8-validate@1.1.0 install PROJECT_PATH\node_modules\webpack-dev-server\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\utf-8-validate
> node-gyp rebuild
试试这个:
- 安装 visual studio 社区 15
- 执行 msbuild 提示符(visual studio 工具访问菜单)
- 将 MsBuild 程序添加到路径 env:
C:\Program Files (x86)\MSBuild.0\Bin
- 执行
npm config set msvs_version 2015 --global
- 将目录添加到一个较短的位置(有时会失败,因为在 windows os 系统中有 260 个字符的限制)
npm-debug 系统和节点 4 io 集成似乎存在故障。如果您尝试使用生成器,请尝试代码是否已经运行 如果您使用的是发电机
我在 Ubuntu 和 Mac 上遇到过这个问题。回滚到 socket.io 版本 1.3.5 应该可以。 Mac 和 Ubuntu 上的命令是:npm install socket.io@1.3.5.
我不知道Window的命令是什么。
已接受的答案并不清楚真正的解决方案。
我在 Win7 上遇到了完全相同的问题,我不得不完全卸载 Node 4.0.0 并从 https://nodejs.org/dist/v0.12.7/
重新安装 0.12.7之后,npm install
完美运行。
除了安装适当的 Visual Studio 和 npm 配置外,您可能还需要删除 'node_modules' 目录才能让 'npm install' 再次工作。
这对我有用
Go to System-Properties (run: systempropertiesadvanced.exe), in Advanced tab, click Environment Variables.
Still on the System variables, click 'New', add "NODE_PATH" with value "C:\nodejs64\node_modules", and click OK.
click 'New' again, add "NODE_SKIP_PLATFORM_CHECK" with value "1", and click OK.
Click OK of all dialogs close.
Restart your machine, so explore and cmd will get the fresh set of variables.