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 安装依赖错误 #77

Open
gaylen1 opened this issue Jul 22, 2022 · 5 comments
Open

npm install 安装依赖错误 #77

gaylen1 opened this issue Jul 22, 2022 · 5 comments

Comments

@gaylen1
Copy link

gaylen1 commented Jul 22, 2022

环境:node v16.16.0
node-sass 6.0.1
python 2.7.15

执行npm install

报错如下:
npm ERR! code 1
npm ERR! path D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c C:\Users\15317\AppData\Local\Temp\postinstall-088c798c.cmd
npm ERR! Building: D:\nodejs\node.exe D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli 'D:\nodejs\node.exe',
npm ERR! gyp verb cli 'D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\node-gyp\bin\node-gyp.js',
npm ERR! gyp verb cli 'rebuild',
npm ERR! gyp verb cli '--verbose',
npm ERR! gyp verb cli '--libsass_ext=',
npm ERR! gyp verb cli '--libsass_cflags=',
npm ERR! gyp verb cli '--libsass_ldflags=',
npm ERR! gyp verb cli '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb which failed Error: not found: python2
npm ERR! gyp verb which failed at getNotFoundError (D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\which\which.js:13:12)
npm ERR! gyp verb which failed at F (D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\which\which.js:68:19)
npm ERR! gyp verb which failed at E (D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\which\which.js:80:29)
npm ERR! gyp verb which failed at D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\which\which.js:89:16
npm ERR! gyp verb which failed at D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\isexe\index.js:42:5
npm ERR! gyp verb which failed at D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb which failed at FSReqCallback.oncomplete (node:fs:198:21)
npm ERR! gyp verb which failed python2 Error: not found: python2
npm ERR! gyp verb which failed at getNotFoundError (D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\which\which.js:13:12)
npm ERR! gyp verb which failed at F (D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\which\which.js:68:19)
npm ERR! gyp verb which failed at E (D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\which\which.js:80:29)
npm ERR! gyp verb which failed at D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\which\which.js:89:16
npm ERR! gyp verb which failed at D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\isexe\index.js:42:5
npm ERR! gyp verb which failed at D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb which failed at FSReqCallback.oncomplete (node:fs:198:21) {
npm ERR! gyp verb which failed code: 'ENOENT'
npm ERR! gyp verb which failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb which succeeded python D:\python\python.EXE
npm ERR! gyp verb check python version D:\python\python.EXE -c "import sys; print "2.7.15 npm ERR! gyp verb check python version .%s.%s" % sys.version_info[:3];" returned: %j
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 16.16.0
npm ERR! gyp verb command install [ '16.16.0' ]
npm ERR! gyp verb install input version string "16.16.0"
npm ERR! gyp verb install installing version: 16.16.0
npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
npm ERR! gyp verb install version is already installed, need to check "installVersion"
npm ERR! gyp verb got "installVersion" 9
npm ERR! gyp verb needs "installVersion" 9
npm ERR! gyp verb install version is good
npm ERR! gyp verb get node dir target node version installed: 16.16.0
npm ERR! gyp verb build dir attempting to create "build" dir: D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\node-sass\build
npm ERR! gyp verb build dir "build" dir needed to be created? D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\node-sass\build
npm ERR! gyp verb build/config.gypi creating config file
npm ERR! gyp verb build/config.gypi writing out config file: D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\node-sass\build\config.gypi
npm ERR! (node:90236) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use node --trace-deprecation ... to show where the warning was created)
npm ERR! gyp verb config.gypi checking for gypi file: D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\node-sass\config.gypi
npm ERR! gyp verb common.gypi checking for gypi file: D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\node-sass\common.gypi
npm ERR! gyp verb gyp gyp format was not specified; forcing "msvs"
npm ERR! gyp info spawn D:\python\python.EXE
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'D:\vsCodeSpace\github\electron-vue-admin-master\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 'msvs',
npm ERR! gyp info spawn args '-G',
npm ERR! gyp info spawn args 'msvs_version=2019',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\node-sass\build\config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\node-gyp\addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\Users\15317\.node-gyp\16.16.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=C:\Users\15317\.node-gyp\16.16.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=C:\Users\15317\.node-gyp\16.16.0\<(target_arch)\node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\node-sass',
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 'D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\node-sass\build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! Traceback (most recent call last):
npm ERR! File "D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\node-gyp\gyp\gyp_main.py", line 16, in
npm ERR! sys.exit(gyp.script_main())
npm ERR! File "D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 545, in script_main
npm ERR! return main(sys.argv[1:])
npm ERR! File "D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 538, in main
npm ERR! return gyp_main(args)
npm ERR! File "D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 514, in gyp_main
npm ERR! options.duplicate_basename_check)
npm ERR! File "D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 98, in Load
npm ERR! generator.CalculateVariables(default_variables, params)
npm ERR! File "D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1916, in CalculateVariables
npm ERR! generator_flags.get('msvs_version', 'auto'))
npm ERR! File "D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\node-gyp\gyp\pylib\gyp\MSVSVersion.py", line 434, in SelectVisualStudioVersion
npm ERR! versions = _DetectVisualStudioVersions(version_map[version], 'e' in version)
npm ERR! KeyError: '2019'
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 (D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\node-gyp\lib\configure.js:345:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:527:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Windows_NT 10.0.22000
npm ERR! gyp ERR! command "D:\nodejs\node.exe" "D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd D:\vsCodeSpace\github\electron-vue-admin-master\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.16.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1

npm ERR! A complete log of this run can be found in:
npm ERR! D:\nodejs\node_cache_logs\2022-07-22T15_28_03_022Z-debug-0.log

期望:
希望博主指点一下。
实在不行希望博主告诉我你运行程序的环境我按照你指定的环境来试试。
---谢谢

@mudalse
Copy link

mudalse commented Jul 31, 2022

node-sass 是大坑,自己用以原本vue-element-admin、electron builder與dart-sass去包就沒這個問題了。

@Real-Rio
Copy link

我npm install也遇到了这个问题,感觉跟node-sass有关,我来来回回换了几个版本还是没整成功

@gaylen1
Copy link
Author

gaylen1 commented Aug 25, 2022

nodejs v14.18.3
node-sass 4.14.1
我试了这两个版本是可以的

@akirapanda
Copy link

 npm ERR! KeyError: '2019'

问题出在本地msvs的版本问题,参考https://github.com/nodejs/node-gyp安装好之后跑下conifg 然后单独install node-sass应该就可以了

@Michael-root
Copy link

不要用它这个了,版本太老了,还会出其他问题的,我搞半天才跑起来。

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

5 participants