Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows 安装问题汇总 #96

Closed
hyj1991 opened this issue Dec 5, 2018 · 30 comments
Closed

Windows 安装问题汇总 #96

hyj1991 opened this issue Dec 5, 2018 · 30 comments

Comments

@hyj1991
Copy link
Owner

hyj1991 commented Dec 5, 2018

因为 Window 下经常有同学爆出安装失败的错误,现在提供如下解决方法:

  • npm install --global --production windows-build-tools
  • npm install -g node-gyp
  • npm install easy-monitor

而对于类似如下报错信息的错误

在此解决方案中一次生成一个项目。若要启用并行生成,请添加 “/m” 开关。
profiler.cc
cpu_profiler.cc
cpu_profile.cc
cpu_profile_node.cc
c:\users\Administrator.node-gyp\10.14.2\include\node\v8.h(342): error C2988: 不可识别的模板声明 / 定义 [D:\nodejs\node_modules\v8-profiler-node8\build\profiler.vcxproj]
c:\users\Administrator.node-gyp\10.14.2\include\node\v8.h(342): error C2059: 语法错误:“using” [D:\nodejs\node_modules\v8-profiler-node8\build\profiler.vcxproj]
c:\users\Administrator.node-gyp\10.14.2\include\node\v8.h(460): error C2332: “enum”: 缺少标记名 [D:\nodejs\node_modules\v8-profiler-node8\build\profiler.vcxproj]
c:\users\Administrator.node-gyp\10.14.2\include\node\v8.h(460): error C2236: 意外的 “class”“v8::WeakCallbackType”。是否忘记了 “;? [D:\nodejs\node_modules\v8-profiler-node8\build\profiler.vcxproj]

可以参见:nodejs 安装 node-gyp 报错 这篇文章的方式解决,实际上就是查看你的 visual studio 版本,然后执行:

  • npm install --msvs_version=<vs 版本,比如 2013>

然后再执行 easy-monitor 的安装。

如果依旧不行的话,可以再开一个 issue 讨论下

@tianyayunhai
Copy link

tianyayunhai commented Dec 13, 2018

node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://node-inspector.s3.amazonaws.co
m/profiler/v5.7.0/node-v64-win32-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for v8-profiler-node8@6.0.1 and n
ode@10.14.2 (node-v64 ABI, unknown) (falling back to source compile with node-gy
p)

v8-profiler-node8@6.0.1 preinstall D:\nodejs\node_modules\v8-profiler-node8
node -e 'process.exit(0)'

v8-profiler-node8@6.0.1 install D:\nodejs\node_modules\v8-profiler-node8
node-pre-gyp install --fallback-to-build

在此解决方案中一次生成一个项目。若要启用并行生成,请添加“/m”开关。
profiler.cc
cpu_profiler.cc
cpu_profile.cc
cpu_profile_node.cc
c:\users\Administrator.node-gyp\10.14.2\include\node\v8.h(342): error C2988: 不可识别的模板声明/定义 [D:\nodejs\node_modules\v8-profiler-node8\build\profiler.vcxproj]
c:\users\Administrator.node-gyp\10.14.2\include\node\v8.h(342): error C2059: 语法错误:“using” [D:\nodejs\node_modules\v8-profiler-node8\build\profiler.vcxproj]
c:\users\Administrator.node-gyp\10.14.2\include\node\v8.h(460): error C2332: “enum”: 缺少标记名 [D:\nodejs\node_modules\v8-profiler-node8\build\profiler.vcxproj]
c:\users\Administrator.node-gyp\10.14.2\include\node\v8.h(460): error C2236: 意外的“class”“v8::WeakCallbackType”。是否忘记了“;”? [D:\nodejs\node_modules\v8-profiler-node8\build\profiler.vcxproj]
c:\users\Administrator.node-gyp\10.14.2\include\node\v8.h(460): error C3381: “v8::WeakCallbackType”: 只有在用 /clr 选项编译的代码中才有程序集访问说明符 [D:\nodejs\node_modules\v8-profiler-node8\build\profiler.vcxproj]
c:\users\Administrator.node-gyp\10.14.2\include\node\v8.h(460): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int [D:\nodejs\node_modules\v8-profiler-node8\build\profiler.vcxproj]
c:\users\Administrator.node-gyp\10.14.2\include\node\v8.h(460): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int [D:\nodejs\node_modules\v8-profiler-node8\build\profiler.vcxproj]
c:\users\Administrator.node-gyp\10.14.2\include\node\v8.h(460): error C2143: 语法错误 : 缺少“;”(在“}”的前面) [D:\nodejs\node_modules\v8-profiler-node8\build\profiler.vcxproj]
c:\users\Administrator.node-gyp\10.14.2\include\node\v8.h(460): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int [D:\nodejs\node_modules\v8-profiler-node8\build\profiler.vcxproj]
c:\users\Administrator.node-gyp\10.14.2\include\node\v8.h(614): error C2253: “PersistentBase”: 纯说明符或抽象重写说明符只允许在虚函数上使用 [D:\nodejs\node_modules\v8-profiler-node8\build\profiler.vcxproj]

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:\nvm\v10.14.2\node_modules\npm\node
_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_proces
s.js:240:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "D:\nodejs\node.exe" "C:\nvm\v10.14.2\node_modules\npm\n
ode_modules\node-gyp\bin\node-gyp.js" "build" "--fallback-to-build" "--module
=D:\nodejs\node_modules\v8-profiler-node8\build\profiler\v6.0.1\node-v64-
win32-x64\profiler.node" "--module_name=profiler" "--module_path=D:\nodejs\no
de_modules\v8-profiler-node8\build\profiler\v6.0.1\node-v64-win32-x64" "--n
api_version=3" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_labe
l=node-v64"
gyp ERR! cwd D:\nodejs\node_modules\v8-profiler-node8
gyp ERR! node -v v10.14.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'D:\nodejs\node.exe C:\nvm\v10.
14.2\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-
build --module=D:\nodejs\node_modules\v8-profiler-node8\build\profiler\v6.0.1\no
de-v64-win32-x64\profiler.node --module_name=profiler --module_path=D:\nodejs\no
de_modules\v8-profiler-node8\build\profiler\v6.0.1\node-v64-win32-x64 --napi_ver
sion=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (
1)
node-pre-gyp ERR! stack at ChildProcess. (C:\nvm\v10.14.2\node_mo
dules\v8-profiler-node8\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/chi
ld_process.js:251:5)
node-pre-gyp ERR! System Windows_NT 6.1.7601
node-pre-gyp ERR! command "D:\nodejs\node.exe" "D:\nodejs\node_modules\v8-p
rofiler-node8\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallb
ack-to-build"
node-pre-gyp ERR! cwd D:\nodejs\node_modules\v8-profiler-node8
node-pre-gyp ERR! node -v v10.14.2
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! v8-profiler-node8@6.0.1 install: node-pre-gyp install --fallback-to-bu ild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the v8-profiler-node8@6.0.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! D:\nodejs\node_cache_logs\2018-12-13T07_52_54_305Z-debug.log

@tianyayunhai
Copy link

按上述操作后还是不行

@hyj1991
Copy link
Owner Author

hyj1991 commented Dec 13, 2018

安装的 vs 版本,windows 版本,node 版本

@hyj1991
Copy link
Owner Author

hyj1991 commented Dec 13, 2018

把上面的 error 删掉一些吧,太长了,页面要拉好久

@tianyayunhai
Copy link

vs2010 windows7 nodejs-v10.14.2

@hyj1991
Copy link
Owner Author

hyj1991 commented Dec 13, 2018

看起来是 vs2010 对 c++ 11 支持的太少了,你可以升级下 vs 看看

@tianyayunhai
Copy link

好的,谢谢

@tianyayunhai
Copy link

我参考这边文章http://www.it610.com/article/3526541.htm解决了上述问题

安装node-gyp后进入到node-gyp安装目录

cd D:\nodejs\node_modules\node-gyp

然后执行

npm install --msvs_version=2010

再安装easy-monitor

npm install easy-monitor

就可以了

@hyj1991
Copy link
Owner Author

hyj1991 commented Dec 13, 2018

@tom429001986 赞👍

@zwlijun
Copy link

zwlijun commented Feb 22, 2019

前提安装好 node-gyp 和 node-pre-gyp

npm install node-gyp -g
npm install node-pre-gyp -g

  1. 通过npm 安装windows的build工具
    npm install --global windows-build-tools
  2. 如果还是不行,检查Python的版本号,Python用windows-build-tools中的Python(2.7)就可以了。如果之前有安装过其他的版本,把系统环境变量path中的Python配置改成window-build-tools中Python中执行路径就可以了。

@hyj1991
Copy link
Owner Author

hyj1991 commented Feb 25, 2019

@zwlijun 对,这两步其实是编译 addon 必备的

@SaltFish001
Copy link

@hyj1991 我遇到了跟#102一样的问题,但是我v8-profiler-node8安装并没有报错,我把详细信息贴在了#102最后面

@hyj1991
Copy link
Owner Author

hyj1991 commented Jun 29, 2019

@SaltFish001 看看运行时候的错误日志

@SaltFish001
Copy link

@hyj1991
[Easy-Monitor] <common.profiler.js> load error: Error: Cannot find module './build/profiler/v6.0.1/node-v70-win32-x64/profiler.node'
Require stack:

  • F:\REconsitution\node_modules\v8-profiler-node8\v8-profiler.js
  • F:\REconsitution\node_modules\easy-monitor\src_logic\common\common.profiler.js
  • F:\REconsitution\node_modules\easy-monitor\src_logic\common\common.js
  • F:\REconsitution\node_modules\easy-monitor\dispatch.js
  • F:\REconsitution\node_modules\easy-monitor\index.js
  • F:\REconsitution\dataHandle\dataHandle.js
    dataHandle:6624
    [Easy-Monitor] <common.profiler.js> load error: Error: Cannot find module './build/profiler/v6.0.1/node-v70-win32-x64/profiler.node'
    Require stack:
  • F:\REconsitution\node_modules\v8-profiler-node8\v8-profiler.js
  • F:\REconsitution\node_modules\easy-monitor\src_logic\common\common.profiler.js
  • F:\REconsitution\node_modules\easy-monitor\src_logic\common\common.js- F:\REconsitution\node_modules\easy-monitor\src_logic\dashboard_fork.js[Easy-Monitor: dashboard <2712>] http_server start at 12333...
    [Easy-Monitor: dashboard <2712>] tcp_server start at 26666...
    [Easy-Monitor: embrace <6624>] connect to 127.0.0.1:26666 success...

@hyj1991
Copy link
Owner Author

hyj1991 commented Jun 29, 2019

load error: Error: Cannot find module './build/profiler/v6.0.1/node-v70-win32-x64/profiler.node'

显然是安装 v8-profiler-node8 失败了

@SaltFish001
Copy link

@hyj1991 这是我v8-profiler-node8的安装日志
PS F:\REconsitution> npm install v8-profiler-node8

v8-profiler-node8@6.0.1 preinstall F:\REconsitution\node_modules\v8-profiler-node8
node -e 'process.exit(0)'

v8-profiler-node8@6.0.1 install F:\REconsitution\node_modules\v8-profiler-node8
node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://node-inspector.s3.amazonaws.com/profiler/v5.7.0/node-v64-win32-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for v8-profiler-node8@6.0.1 and node@10.15.0 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
在此解决方案中一次生成一个项目。若要启用并行生成,请添加“/m”开关。
profiler.cc
cpu_profiler.cc
cpu_profile.cc
cpu_profile_node.cc
heap_profiler.cc
heap_snapshot.cc
heap_output_stream.cc
heap_graph_node.cc
heap_graph_edge.cc
f:\reconsitution\node_modules\v8-profiler-node8\src\heap_profiler.cc(114): warning C4996: 'v8::Value::Uint32Value': 被声明
为已否决 [F:\REconsitution\node_modules\v8-profiler-node8\build\profiler.vcxproj]
c:\users\lyp.node-gyp\10.15.0\include\node\v8.h(2477): note: 参见“v8::Value::Uint32Value”的声明
f:\reconsitution\node_modules\v8-profiler-node8\src\heap_graph_node.cc(70): warning C4996: 'v8::Value::ToObject': 被声明为已
否决 [F:\REconsitution\node_modules\v8-profiler-node8\build\profiler.vcxproj]
c:\users\lyp.node-gyp\10.15.0\include\node\v8.h(10046): note: 参见“v8::Value::ToObject”的声明
f:\reconsitution\node_modules\v8-profiler-node8\src\cpu_profiler.cc(38): warning C4996: 'v8::Value::ToBoolean': 被声明为已否决
[F:\REconsitution\node_modules\v8-profiler-node8\build\profiler.vcxproj]
c:\users\lyp.node-gyp\10.15.0\include\node\v8.h(10034): note: 参见“v8::Value::ToBoolean”的声明
f:\reconsitution\node_modules\v8-profiler-node8\src\cpu_profiler.cc(73): warning C4996: 'v8::Value::Uint32Value': 被声明为已
否决 [F:\REconsitution\node_modules\v8-profiler-node8\build\profiler.vcxproj]
c:\users\lyp.node-gyp\10.15.0\include\node\v8.h(2477): note: 参见“v8::Value::Uint32Value”的声明
f:\reconsitution\node_modules\v8-profiler-node8\src\heap_snapshot.cc(62): warning C4996: 'v8::Value::Int32Value': 被声明为已
否决 [F:\REconsitution\node_modules\v8-profiler-node8\build\profiler.vcxproj]
c:\users\lyp.node-gyp\10.15.0\include\node\v8.h(2478): note: 参见“v8::Value::Int32Value”的声明
f:\reconsitution\node_modules\v8-profiler-node8\src\heap_snapshot.cc(74): warning C4996: 'v8::Value::Int32Value': 被声明为已
否决 [F:\REconsitution\node_modules\v8-profiler-node8\build\profiler.vcxproj]
c:\users\lyp.node-gyp\10.15.0\include\node\v8.h(2478): note: 参见“v8::Value::Int32Value”的声明
正在创建库 F:\REconsitution\node_modules\v8-profiler-node8\build\Release\profiler.lib 和对象 F:\REconsitution\node_modules
v8-profiler-node8\build\Release\profiler.exp
正在生成代码
All 306 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
已完成代码的生成
profiler.vcxproj -> F:\REconsitution\node_modules\v8-profiler-node8\build\Release\profiler.node
Copying F:\REconsitution\node_modules\v8-profiler-node8\build\Release/profiler.node to F:/REconsitution/node_modules
/v8-profiler-node8/build/profiler/v6.0.1/node-v64-win32-x64\profiler.node
已复制 1 个文件。
npm WARN react-app-rewire-less@2.1.3 requires a peer of react-app-rewired@^1.5.2 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.0.6 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.0.6: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

  • v8-profiler-node8@6.0.1
    updated 1 package and audited 904998 packages in 29.239s
    found 12 high severity vulnerabilities
    run npm audit fix to fix them, or npm audit for details
    PS F:\REconsitution> npm audit fix
    npm WARN react-app-rewire-less@2.1.3 requires a peer of react-app-rewired@^1.5.2 but none is installed. You must install peer dependencies yourself.
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\jest-haste-map\node_modules\fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.0.6 (node_modules\fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.0.6: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\chokidar\node_modules\fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

removed 2 packages and updated 4 packages in 31.044s
fixed 12 of 12 vulnerabilities in 904998 scanned packages

@hyj1991
Copy link
Owner Author

hyj1991 commented Jun 29, 2019

你编译用的 node 版本和运行这个进程用的 node 版本不一样啊。。。

/v8-profiler-node8/build/profiler/v6.0.1/node-v64-win32-x64\profiler.node

这里显然是 node 版本内置的 NODE_MODULES 是 64,而你运行的时候请求的是:

Cannot find module './build/profiler/v6.0.1/node-v70-win32-x64/profiler.node'

这里寻找的是 70 这个版本的 node runtime,v8-profiler-node8 这个包是 addon,跨版本间是 ABI 不兼容的,没法运行

@SaltFish001
Copy link

@hyj1991 是不是不支持node v12.0.0

@hyj1991
Copy link
Owner Author

hyj1991 commented Jun 29, 2019

@hyj1991 是不是不支持node v12.0.0

马上要支持了,参见 v8-profiler-node8#pr#8

@SaltFish001
Copy link

@hyj1991 新的报错,还是不行
[Easy-Monitor] <common.profiler.js> load error: Error: A dynamic link library (DLL) initialization routine failed.
\?\F:\REconsitution\node_modules\v8-profiler-node8\build\profiler\v6.0.1\node-v64-win32-x64\profiler.node
dataHandle:9564
127.0.0.1 Can not connect!!!
[Easy-Monitor] <common.profiler.js> load error: Error: A dynamic link library (DLL) initialization routine failed.
\?\F:\REconsitution\node_modules\v8-profiler-node8\build\profiler\v6.0.1\node-v64-win32-x64\profiler.node
[Easy-Monitor: dashboard <9708>] http_server start at 12333...
[Easy-Monitor: dashboard <9708>] tcp_server start at 26666...
[Easy-Monitor: embrace <9564>] connect to 127.0.0.1:26666 success...

@hyj1991
Copy link
Owner Author

hyj1991 commented Jul 2, 2019

@SaltFish001 已经发布了 v8-profiler-node8@6.1.0,支持 node-v4.x ~ node-v12.x,现在应该可以了吧

@SaltFish001
Copy link

@hyj1991 上次的报错是我在10.11.0下测试得到的报错

@hyj1991
Copy link
Owner Author

hyj1991 commented Jul 2, 2019

@hyj1991 上次的报错是我在10.11.0下测试得到的报错

这是一个 Addon,依赖于你的 node 版本编译的,你要在 10.11.0 下用,得用 node-v10.11.0 来进行编译

@SaltFish001
Copy link

@hyj1991 ,我是用的10.11.0编译,我用nvm切换了版本的

@hyj1991
Copy link
Owner Author

hyj1991 commented Jul 2, 2019

这显然是编译都没过啊,所以才找不到

@hyj1991
Copy link
Owner Author

hyj1991 commented Jul 2, 2019

手动试下 npm i v8-profiler-node8 看看

@SaltFish001
Copy link

@hyj1991 没有报错,但有很多warn,跟之前安装日志是一样的

@hyj1991
Copy link
Owner Author

hyj1991 commented Jul 2, 2019

@SaltFish001 你是不是有 package-json.lock 文件锁版本了啊,最新的是 v8-profiler-node8@6.1.0

@hyj1991
Copy link
Owner Author

hyj1991 commented Jul 2, 2019

warning 我都解决掉了

@hyj1991
Copy link
Owner Author

hyj1991 commented Jul 2, 2019

@SaltFish001 我找了台 win 的电脑,试了下 10.11.0 下安装 v8-profiler-node8 这个包,这样才是成功的:

微信截图_20190702114651

@hyj1991 hyj1991 closed this as completed Jul 16, 2019
@hyj1991 hyj1991 pinned this issue Jul 16, 2019
@hyj1991 hyj1991 changed the title 【重要】Windows 安装失败用户可以参考这里 Windows 安装问题汇总 Jul 16, 2019
@hyj1991 hyj1991 unpinned this issue Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants