报错信息:
gyp ERR! stack Error: Command failed: C:\Users\liufei\AppData\Local\Programs\Python\Python37\python.EXE -c import sys; print “%s.%s.%s” %
完整报错:
F:\webstorm\cloud-desktop> npm install
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
> xxhash-addon@1.4.0 install F:\webstorm\cloud-desktop\node_modules\xxhash-addon
> node-gyp rebuild --ensure
F:\webstorm\cloud-desktop\node_modules\xxhash-addon>if not defined npm_config_node_gyp (node "E:\node\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild --ensure ) else (node "E:\node\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild --ensure )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\liufei\AppData\Local\Programs\Python\Python37\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "<string>", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at maybeClose (internal/child_process.js:982:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "E:\\node\\node.exe" "E:\\node\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--ensure"
gyp ERR! cwd F:\webstorm\cloud-desktop\node_modules\xxhash-addon
gyp ERR! node -v v10.16.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN @babel/plugin-syntax-jsx@7.14.5 requires a peer of @babel/core@^7.0.0-0 but none is installed. You must install peer dependencies yourself.
npm WARN @vue/babel-plugin-transform-vue-jsx@1.2.1 requires a peer of @babel/core@^7.0.0-0 but none is installed. You must install peer dependencies yourself.
npm WARN cloud-desktop@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! xxhash-addon@1.4.0 install: `node-gyp rebuild --ensure`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the xxhash-addon@1.4.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\liufei\AppData\Roaming\npm-cache\_logs\2021-06-10T02_12_29_752Z-debug.log
解决办法
步骤一
npm install --global --production windows-build-tools
npm install -g node-gyp
如果执行第一句执行没有成功,例如我的:
这里卡在安装python了,直接终止执行步骤二即可。
步骤二
上面步骤一如果没有安装好python2.7,则安装下
npm install --python=python2.7
npm config set python python2.7
步骤三
npm install
npm run dev
启动成功!!
参考
https://blog.csdn.net/qfxlw/article/details/85331869