node-sass 依賴包不能安裝問題
阿新 • • 發佈:2018-12-22
1.問題
最近在搗鼓畢業設計時,因為需要進行微信公眾號開發,學起了vue。在用vue開發頁面的時候執行npm run dev 指令出現了下面的錯誤:
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT
HON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:Users***AppDataRoami
ngnpmnode_modulesnode-sassnode_modulesnode-gyplibconfigure.js:483:19)
gyp ERR! stack at PythonFinder.<anonymous> (C:Users**
gnpmnode_modulesnode-sassnode_modulesnode-gyplibconfigure.js:508:16)
gyp ERR! stack at C:Users***AppDataRoamingnpmnode_modulesnode-sa
ssnode_modulesgraceful-fspolyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "D:\Program Files\nodejs\node.exe" "C:\Users\*
Data\Roaming\npm\node_modules\node-sass\node_modules\node-gyp\bin\node-g
yp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldf
lags=" "--libsass_library="
gyp ERR! cwd C:Users***AppDataRoamingnpmnode_modulesnode-sass
gyp ERR! node -v v8.0.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Build failed with error code: 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR!
node scripts/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:Users***AppDataRoamingnpm-cache_logs2017-07-06T01_07_
47_983Z-debug.log
2.解決辦法
自己也是查詢了別人的相關資料,使用使用淘寶映象 cnpm install node-ssas 安裝就可以解決以上問題,可能的原因是本人專案的環境是使用淘寶映象拉取安裝的,不相容npm拉取的,也有可能是node-ssas需要編譯python環境和本人linux環境剛升python3不相容,使用npm預設python2版本安裝不了。