刚下载了VueJS材料仪表板(带有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
以下是package.json on VueJS材料仪表板项目:
{
"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的最新解决方案。
发布于 2021-09-10 12:25:31
分三步解决
Windows x86-64 MSI installer安装python2.7environment variables,在我的示例中是C:\Python27npm cache clean --force && rm -rf node_modules package-lock.json && npm install。https://stackoverflow.com/questions/69129340
复制相似问题