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

npm install 模板报错 #660

Open
zt102545 opened this issue Feb 10, 2021 · 12 comments
Open

npm install 模板报错 #660

zt102545 opened this issue Feb 10, 2021 · 12 comments

Comments

@zt102545
Copy link

npm WARN deprecated core-js@2.6.12: 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 node-gyp@3.8.0
npm ERR! gyp info using node@15.3.0 | 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

@wind-labs
Copy link

wind-labs commented Feb 19, 2021

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 node-gyp@3.8.0
npm ERR! gyp info using node@12.18.3 | 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版本的问题么?

@wsy901125
Copy link

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

@wsy901125
Copy link

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

@CheungKooHo
Copy link

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 node-gyp@3.8.0
npm ERR! gyp info using node@12.19.0 | 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

python@3.9报这个,2.7会爆其他错误但是也包含npm ERR! code 1

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

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

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

@ChenSino
Copy link

ChenSino commented Jun 4, 2021

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

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

@Sh1-5
Copy link

Sh1-5 commented Jul 18, 2021

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

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

@chending1983
Copy link

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

@chen-xin-jie
Copy link

// 下载完后,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 node-gyp@7.1.2
npm ERR! gyp info using node@16.5.0 | 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`

@wmhello
Copy link

wmhello commented Aug 4, 2021 via email

@YLLL-ux
Copy link

YLLL-ux commented Sep 25, 2021

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 node-gyp@3.8.0
npm ERR! gyp info using node@14.17.6 | 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

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

@oubeichen
Copy link

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 vue-admin-template@4.4.0 No repository field.

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! deasync@0.1.21 install: node ./build.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the deasync@0.1.21 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

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

@dagedan
Copy link

dagedan commented Oct 24, 2023

要命啊,我也遇到了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

13 participants