vue-admin-template icon indicating copy to clipboard operation
vue-admin-template copied to clipboard

npm install 模板报错

Open zt102545 opened this issue 4 years ago • 12 comments
trafficstars

npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3. npm ERR! code 1 npm ERR! path F:\Demo\ZZT\ZZTABP\vue-admin-template\node_modules\canvas npm ERR! command failed npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using [email protected] npm ERR! gyp info using [email protected] | win32 | x64 npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error: Command failed: C:\Users\zzt\AppData\Local\Programs\Python\Python39\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack File "", line 1 npm ERR! gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3]; npm ERR! gyp ERR! stack ^ npm ERR! gyp ERR! stack SyntaxError: invalid syntax npm ERR! gyp ERR! stack npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:309:12) npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:376:20) npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1055:16) npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:288:5) npm ERR! gyp ERR! System Windows_NT 10.0.18363 npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "F:\Demo\ZZT\ZZTABP\vue-admin-template\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd F:\Demo\ZZT\ZZTABP\vue-admin-template\node_modules\canvas npm ERR! gyp ERR! node -v v15.3.0 npm ERR! gyp ERR! node-gyp -v v3.8.0 npm ERR! gyp ERR! not ok

zt102545 avatar Feb 10 '21 07:02 zt102545

npm ERR! code 1 npm ERR! path D:\Vue\vue-admin-template\node_modules\fibers npm ERR! command failed npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using [email protected] npm ERR! gyp info using [email protected] | win32 | x64 npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error: Command failed: C:\Users\Wind\AppData\Local\Programs\Python\Python39\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3]; npm ERR! gyp ERR! stack File "", line 1 npm ERR! gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3]; npm ERR! gyp ERR! stack ^ npm ERR! gyp ERR! stack SyntaxError: invalid syntax npm ERR! gyp ERR! stack npm ERR! gyp ERR! stack at ChildProcess.exithandler (child_process.js:303:12) npm ERR! gyp ERR! stack at ChildProcess.emit (events.js:315:20) npm ERR! gyp ERR! stack at maybeClose (internal/child_process.js:1021:16) npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) npm ERR! gyp ERR! System Windows_NT 10.0.17763 npm ERR! gyp ERR! command "D:\Node.js\node.exe" "D:\Vue\vue-admin-template\node_modules\node-gyp\bin\node-gyp.js" "rebuild" npm ERR! gyp ERR! cwd D:\Vue\vue-admin-template\node_modules\fibers npm ERR! gyp ERR! node -v v12.18.3 npm ERR! gyp ERR! node-gyp -v v3.8.0 npm ERR! gyp ERR! not ok

同样的问题,会是因为python版本的问题么?

wind-labs avatar Feb 19 '21 06:02 wind-labs

可以安装python2.7 然后npm config一下python的版本为python2.7 但是也会报别的错

wsy901125 avatar Feb 24 '21 08:02 wsy901125

刚刚把淘宝源的配置和python的配置都删除了又试了一下就可以了 可能需要直接通过npm自带的源去install才行

wsy901125 avatar Feb 24 '21 08:02 wsy901125

npm ERR! code 1
npm ERR! path /Users/mac/Desktop/coan/project/vue-admin-template/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | x64
npm ERR! gyp info spawn /usr/bin/python2
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/Users/mac/Desktop/coan/project/vue-admin-template/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/mac/Desktop/coan/project/vue-admin-template/node_modules/canvas/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/mac/Desktop/coan/project/vue-admin-template/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/mac/.node-gyp/12.19.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/Users/mac/.node-gyp/12.19.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/Users/mac/Desktop/coan/project/vue-admin-template/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/mac/.node-gyp/12.19.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/mac/Desktop/coan/project/vue-admin-template/node_modules/canvas',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! /bin/sh: pkg-config: command not found
npm ERR! gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/Users/mac/Desktop/coan/project/vue-admin-template/node_modules/node-gyp/lib/configure.js:345:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
npm ERR! gyp ERR! System Darwin 20.4.0
npm ERR! gyp ERR! command "/usr/local/bin/node" "/Users/mac/Desktop/coan/project/vue-admin-template/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /Users/mac/Desktop/coan/project/vue-admin-template/node_modules/canvas
npm ERR! gyp ERR! node -v v12.19.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mac/.npm/_logs/2021-04-28T16_17_26_189Z-debug.log

[email protected]报这个,2.7会爆其他错误但是也包含npm ERR! code 1

原以为是node-gyp问题,经过一天的折腾,发现并没有什么卵用,排除

然后在国外论坛看到有人说是canvas已知bug,原因好像是因为缺少lib,尝试无果

最终解决方案:nrm use npm,npm install,npm run dev成功运行,解决--【需要使用npm自己的源安装】

CheungKooHo avatar Apr 28 '21 16:04 CheungKooHo

刚刚把淘宝源的配置和python的配置都删除了又试了一下就可以了 可能需要直接通过npm自带的源去install才行

我气死了,折腾了几天,按照你这个方法删除了淘宝的源另外加个代理就好了,为啥???

ChenSino avatar Jun 04 '21 09:06 ChenSino

刚刚把淘宝源的配置和python的配置都删除了又试了一下就可以了 可能需要直接通过npm自带的源去install才行

心态很崩,尝试了各种方法,结果看到你这个立马就去切换了一下源,成了

Sh1-5 avatar Jul 18 '21 22:07 Sh1-5

遇到同样的问题,因为镜像源的问题,出错时使用的是taobao的mirror,换成原镜像源install成功,成功运行。 我因为有两个前端项目,一个是从头开始写的,引入组件较少,可以install直接运行,因此,这种情况下,只可能是相关的依赖无法安装成功,换源问题解决。

chending1983 avatar Jul 21 '21 05:07 chending1983

更换源也解决不了怎么办呀?

Ervilhas-Liu avatar Jul 31 '21 09:07 Ervilhas-Liu

clang: error: no such file or directory: 'worker/vue-admin-template/node_modules/node-addon-api' make: *** [Release/obj.target/deasync/src/deasync.o] Error 1 gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23) gyp ERR! stack at ChildProcess.emit (node:events:394:28) gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) gyp ERR! System Darwin 20.4.0 gyp ERR! command "/opt/homebrew/Cellar/node/16.4.2/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /Users/momo/code worker/vue-admin-template/node_modules/deasync gyp ERR! node -v v16.4.2 gyp ERR! node-gyp -v v5.1.0 gyp ERR! not ok Build failed npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] install: node ./build.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] 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! /Users/momo/.npm/_logs/2021-07-31T09_58_38_617Z-debug.log

Ervilhas-Liu avatar Jul 31 '21 09:07 Ervilhas-Liu

// 下载完后,npm i 报错, 配置了python 环境 并把镜像源切换成了npm 还是报如下错误 // 请各位大神指点一二, 谢谢 !!!

`npm ERR! code 1 npm ERR! path D:\ch\vue-admin-template\vue-admin-template\node_modules\deasync npm ERR! command failed npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node ./build.js npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using [email protected] npm ERR! gyp info using [email protected] | win32 | x64 npm ERR! gyp info find Python using Python version 3.7.9 found at "D:\xiaZai\python\python.exe" npm ERR! gyp ERR! find VS npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt npm ERR! gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details npm ERR! gyp ERR! find VS looking for Visual Studio 2015 npm ERR! gyp ERR! find VS - not found npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8 npm ERR! gyp ERR! find VS npm ERR! gyp ERR! find VS ************************************************************** npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload. npm ERR! gyp ERR! find VS For more information consult the documentation at: npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows npm ERR! gyp ERR! find VS ************************************************************** npm ERR! gyp ERR! find VS npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use npm ERR! gyp ERR! stack at VisualStudioFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47) npm ERR! gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16 npm ERR! gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14) npm ERR! gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14 npm ERR! gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16 npm ERR! gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7 npm ERR! gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16 npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:404:5) npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:394:28) npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1067:16) npm ERR! gyp ERR! System Windows_NT 10.0.19042 npm ERR! 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" npm ERR! gyp ERR! cwd D:\ch\vue-admin-template\vue-admin-template\node_modules\deasync npm ERR! gyp ERR! node -v v16.5.0 npm ERR! gyp ERR! node-gyp -v v7.1.2 npm ERR! gyp ERR! not ok npm ERR! Build failed

npm ERR! A complete log of this run can be found in: npm ERR! D:\Program Files\nodejs\node_cachecls_logs\2021-08-03T01_50_53_557Z-debug.log`

chen-xin-jie avatar Aug 03 '21 01:08 chen-xin-jie

想系统学习使用可以私聊我 wx是xpyzwm 如果只是问答案  网络上有很多

---原始邮件--- 发件人: @.> 发送时间: 2021年7月31日(周六) 下午5:57 收件人: @.>; 抄送: @.***>; 主题: Re: [PanJiaChen/vue-admin-template] npm install 模板报错 (#660)

更换源也解决不了怎么办呀?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

wmhello avatar Aug 04 '21 08:08 wmhello

npm ERR! code 1 npm ERR! path F:\Gitspace\vue-element-template\vue-admin-template\node_modules\bufferutil npm ERR! command failed npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using [email protected] npm ERR! gyp info using [email protected] | win32 | x64 npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error: Can't find Python executable "python2.7", you can set the PYTHON env variable. npm ERR! gyp ERR! stack at PythonFinder.failNoPython (F:\Gitspace\vue-element-template\vue-admin-template\node_modules\node-gyp\lib\configure.js:484:19) npm ERR! gyp ERR! stack at PythonFinder. (F:\Gitspace\vue-element-template\vue-admin-template\node_modules\node-gyp\lib\configure.js:509:16) npm ERR! gyp ERR! stack at callback (F:\Gitspace\vue-element-template\vue-admin-template\node_modules\graceful-fs\polyfills.js:299:20) npm ERR! gyp ERR! stack at FSReqCallback.oncomplete (fs.js:192:21) npm ERR! gyp ERR! System Windows_NT 10.0.19041 npm ERR! gyp ERR! command "D:\dev\nodejs\node.exe" "F:\Gitspace\vue-element-template\vue-admin-template\node_modules\node-gyp\bin\node-gyp.js" "rebuild" npm ERR! gyp ERR! cwd F:\Gitspace\vue-element-template\vue-admin-template\node_modules\bufferutil npm ERR! gyp ERR! node -v v14.17.6 npm ERR! gyp ERR! node-gyp -v v3.8.0 npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in: npm ERR! D:\dev\nodejs\node_cache_logs\2021-09-25T07_15_12_148Z-debug.log

有没有什么好的解决办法?????

YLLL-ux avatar Sep 25 '21 07:09 YLLL-ux

clang: error: no such file or directory: 'worker/vue-admin-template/node_modules/node-addon-api' make: *** [Release/obj.target/deasync/src/deasync.o] Error 1 gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23) gyp ERR! stack at ChildProcess.emit (node:events:394:28) gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) gyp ERR! System Darwin 20.4.0 gyp ERR! command "/opt/homebrew/Cellar/node/16.4.2/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /Users/momo/code worker/vue-admin-template/node_modules/deasync gyp ERR! node -v v16.4.2 gyp ERR! node-gyp -v v5.1.0 gyp ERR! not ok Build failed npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] install: node ./build.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] 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! /Users/momo/.npm/_logs/2021-07-31T09_58_38_617Z-debug.log

你这个报错是路径里带空格的问题 https://github.com/nodejs/node-gyp/pull/2556 用了几年 node 第一次碰到这个问题,排查了半天……

oubeichen avatar Mar 24 '22 11:03 oubeichen

要命啊,我也遇到了

dagedan avatar Oct 24 '23 10:10 dagedan