【发布时间】:2021-11-06 18:40:42
【问题描述】:
刚刚下载了VueJS Material Dashboard (with Laravel),但是当我在这个 VueJS 模板上尝试npm install 时,它显示错误 1。它提到了与 gyp 和 python39 相关的错误。即使我以管理员身份使用 node.js 命令提示符,它仍然显示错误。
npm ERR! code 1
npm ERR! path D:\Technolife\xampp\htdocs\spk-or-as-main\node_modules\fibers
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node build.js || nodejs build.js
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@16.9.0 | win32 | x64
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: C:\Python39\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack File "<string>", 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:397:12)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:394:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1064:16)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\Technolife\\xampp\\htdocs\\spk-or-as-main\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--release"
npm ERR! gyp ERR! cwd D:\Technolife\xampp\htdocs\spk-or-as-main\node_modules\fibers
npm ERR! gyp ERR! node -v v16.9.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! node-gyp exited with code: 1
npm ERR! Please make sure you are using a supported platform and node version. If you
npm ERR! would like to compile fibers on this machine please make sure you have setup your
npm ERR! build environment--
npm ERR! Windows + OS X instructions here: https://github.com/nodejs/node-gyp
npm ERR! Ubuntu users please run: `sudo apt-get install g++ build-essential`
npm ERR! RHEL users please run: `yum install gcc-c++` and `yum groupinstall 'Development Tools'`
npm ERR! Alpine users please run: `sudo apk add python make g++`
npm ERR! 'nodejs' is not recognized as an internal or external command,
npm ERR! operable program or batch file.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\noxer\AppData\Local\npm-cache\_logs\2021-09-10T08_02_45_175Z-debug.log
这是 VueJS Material Dashboard 项目的 package.json:
{
"name": "vue-material-dashboard-pro",
"version": "1.4.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve --open",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"dev": "npm run serve",
"deploy": "npm run build && cd docs && npm run build && cd .. && sudo gh-pages -d dist",
"install:clean": "rm -rf node_modules/ && rm -rf package-lock.json && npm install && npm run dev"
},
"dependencies": {
"@fullcalendar/core": "4.4.0",
"@fullcalendar/daygrid": "4.4.0",
"@fullcalendar/interaction": "4.4.0",
"@fullcalendar/timegrid": "^4.4.0",
"@fullcalendar/vue": "4.4.0",
"@tweenjs/tween.js": "18.5.0",
"acorn-dynamic-import": "^4.0.0",
"axios": "^0.19.2",
"chartist": "0.11.4",
"dotenv": "^8.2.0",
"es6-promise": "4.2.8",
"fuse.js": "3.6.1",
"google-maps": "4.2.3",
"jquery": "^3.5.1",
"jsona": "^1.6.0",
"jvectormap-next": "3.1.0",
"lodash": "^4.17.15",
"moment": "^2.24.0",
"nouislider": "14.1.1",
"perfect-scrollbar": "1.5.0",
"qs": "^6.9.4",
"sweetalert2": "9.10.0",
"vee-validate": "3.2.5",
"vue": "2.6.11",
"vue-authenticate": "^1.4.1",
"vue-axios": "^2.1.5",
"vue-clickaway": "2.2.2",
"vue-color": "^2.7.1",
"vue-github-buttons": "3.1.0",
"vue-material": "^1.0.0-beta-11",
"vue-router": "3.1.6",
"vue-social-sharing": "2.4.7",
"vue2-transitions": "0.3.0",
"vuex": "^3.4.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "4.2.3",
"@vue/cli-plugin-eslint": "4.2.3",
"@vue/cli-plugin-router": "4.2.3",
"@vue/cli-service": "4.2.3",
"@vue/eslint-config-prettier": "6.0.0",
"babel-eslint": "10.1.0",
"eslint": "6.8.0",
"eslint-plugin-prettier": "3.1.2",
"eslint-plugin-vue": "6.2.2",
"fibers": "4.0.2",
"gulp": "4.0.2",
"gulp-append-prepend": "1.0.8",
"node-sass": "4.13.1",
"prettier": "1.19.1",
"sass": "1.26.3",
"sass-loader": "^8.0.2",
"vue-template-compiler": "2.6.11"
}
}
那么,这有什么问题呢?我试图找到类似的问题,但它已经过时了,我希望你能为这个npm install错误代码1提供最新的解决方案。
【问题讨论】:
-
你能提供
npm version的输出吗? -
好的,我的npm版本是7.23.0
-
Node.js 的版本是什么?
-
我的 Node.js 版本是 16.9.0
-
最近16版本的Node.js有问题,能降级到14吗?
标签: node.js vue.js npm node-gyp