关于window10,安装node.js在前端项目下打包(npm install)失败,提示找不到python的情况,安装python以后依然提示找不到python,即使你配置了环境变量也无法找了python的正确路径。
gyp verb check python checking for Python executable "python2.7" in the PATH
gyp verb `which` failed Error: not found: python2.7
gyp verb `which` failed at getNotFoundError (C:\Users\Sparkle\Desktop\Vue\sparkle\node_modules\which\which.js:13:12)
gyp verb `which` failed at F (C:\Users\Sparkle\Desktop\Vue\sparkle\node_modules\which\which.js:68:19)
gyp verb `which` failed at E (C:\Users\Sparkle\Desktop\Vue\sparkle\node_modules\which\which.js:80:29)
gyp verb `which` failed at C:\Users\Sparkle\Desktop\Vue\sparkle\node_modules\which\which.js:89:16
gyp verb `which` failed at C:\Users\Sparkle\Desktop\Vue\sparkle\node_modules\isexe\index.js:42:5
gyp verb `which` failed at C:\Users\Sparkle\Desktop\Vue\sparkle\node_modules\isexe\windows.js:36:5
gyp verb `which` failed at FSReqCallback.oncomplete (fs.js:176:21)
gyp verb `which` failed python2.7 Error: not found: python2.7
gyp verb `which` failed at getNotFoundError (C:\Users\Sparkle\Desktop\Vue\sparkle\node_modules\which\which.js:13:12)
gyp verb `which` failed at F (C:\Users\Sparkle\Desktop\Vue\sparkle\node_modules\which\which.js:68:19)
gyp verb `which` failed at E (C:\Users\Sparkle\Desktop\Vue\sparkle\node_modules\which\which.js:80:29)
gyp verb `which` failed at C:\Users\Sparkle\Desktop\Vue\sparkle\node_modules\which\which.js:89:16
gyp verb `which` failed at C:\Users\Sparkle\Desktop\Vue\sparkle\node_modules\isexe\index.js:42:5
gyp verb `which` failed at C:\Users\Sparkle\Desktop\Vue\sparkle\node_modules\isexe\windows.js:36:5
gyp verb `which` failed at FSReqCallback.oncomplete (fs.js:176:21) {
gyp verb `which` failed code: 'ENOENT'
gyp verb `which` failed }
gyp verb could not find "python2.7". checking python launcher
gyp verb could not find "python2.7". guessing location
gyp verb ensuring that file exists: C:\Python27\python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python2.7", you can set the PYTHON env variable.
之前用的是window7的操作系统,以前环境没有装python,项目打包正常,后来操作系统升级windos10后出现打包失败的问题。试了网上说的通过语句设置环境变量,发现不行,试了网上说的很多方法都还是不行。
通过读打包报错的日志,发现上面报错日志的第22条记录。
gyp verb ensuring that file exists: C:\Python27\python.exe
于是怀疑是不是因为python的安装路径不对,所以一直报错找不到。经过重新安装python在C:\Python27\路径后,果然问题解决了。
虽然问题解决了,但是我想python的这个路径问题一定是在哪配置的,于是我尝试在node下找了下相关的配置文件,由于手头还有其他事情最后还是放弃了,如有高手知道还请指点一下。