WebStorm 执行 npminstall ,报如下错误 

gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\Administrator\AppData\Local\Programs\Python\Python38\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                       ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:308:12)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at maybeClose (internal/child_process.js:1048:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\Proj\\dcy-fast-vue\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--
libsass_ldflags=" "--libsass_library="
gyp ERR! cwd D:\Proj\dcy-fast-vue\node_modules\node-sass
gyp ERR! node -v v14.16.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.14.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.14.1 postinstall 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!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2021-08-25T14_39_39_365Z-debug.log

原因:是Python2版本未安装指定。


安装:如下:

1. 下载:

python-2.7.18.amd64.msi   

python-2.7.12   

python-2.7.3   

python-2.7.13   

python-2.7.14   

python-2.7.18   


2. 安装:


3. 设置:命令如下:

>npm config set python C:\Python27

>npm install