javascript - 用npm安裝Node-Sass老是報錯是怎么回事?
問題描述
錯誤代碼:gyp ERR! configure errorgyp ERR! stack Error: Can’t find Python executable 'python', you can set the PYTHON env variable.gyp ERR! stack at PythonFinder.failNoPython (C:Users***AppDataRoamingnpmnode_modulesnode-sassnode_modulesnode-gyplibconfigure.js:483:19)gyp ERR! stack at PythonFinder.<anonymous> (C:Users***AppDataRoamingnpmnode_modulesnode-sassnode_modulesnode-gyplibconfigure.js:508:16)gyp ERR! stack at C:Users***AppDataRoamingnpmnode_modulesnode-sassnode_modulesgraceful-fspolyfills.js:284:29gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)gyp ERR! System Windows_NT 6.1.7601gyp ERR! command 'D:Program Filesnodejsnode.exe' 'C:Users*AppDataRoamingnpmnode_modulesnode-sassnode_modulesnode-gypbinnode-gyp.js' 'rebuild' '--verbose' '--libsass_ext=' '--libsass_cflags=' '--libsass_ldflags=' '--libsass_library='gyp ERR! cwd C:Users***AppDataRoamingnpmnode_modulesnode-sassgyp ERR! node -v v8.0.0gyp ERR! node-gyp -v v3.6.2gyp ERR! not okBuild failed with error code: 1npm ERR! code ELIFECYCLEnpm ERR! errno 1npm ERR! node-sass@4.5.3 postinstall: node scripts/build.jsnpm ERR! Exit status 1npm ERR!npm ERR! Failed at the node-sass@4.5.3 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***AppDataRoamingnpm-cache_logs2017-07-06T01_07_47_983Z-debug.log
求大佬指點,給大佬遞茶。公司內(nèi)網(wǎng),代理已經(jīng)配置好,不過我的權(quán)限可能有的網(wǎng)站和端口會訪問不了,github能上,node.js官網(wǎng)能上,源用的是cnpm。
問題解答
回答1:在跟package.json同目錄創(chuàng)一個名為.npmrc的文件,然后裝個python,最好是2.X版本
把下面這句東西放進去
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/回答2:
提示是需要安裝python,可以安裝個python試試,然后配下PYTHON 的環(huán)境變量,重新安裝試試看。
回答3:根目錄創(chuàng)建.npmrc
phantomjs_cdnurl=http://cnpmjs.org/downloadssass_binary_site=https://npm.taobao.org/mirrors/node-sass/registry=https://registry.npm.taobao.org
保存后 重新npm install
回答4:我昨天也試過安裝nodesass失敗,后面轉(zhuǎn)用淘寶鏡像裝就成功了$ npm install -g cnpm --registry=https://registry.npm.taobao.org (安裝淘寶鏡像)
$ cnpm install node-sass --save (使用淘寶鏡像安裝node-sass)
相關(guān)文章:
1. 視頻文件不能播放,怎么辦?2. node.js - nodejs開發(fā)中常用的連接mysql的庫3. mysql replace 死鎖4. phpstudy pro小皮面板經(jīng)常報這個nginx: [emerg] CreateFile【急】5. 老師您的微信號是多少?6. mysql - 把一個表中的數(shù)據(jù)count更新到另一個表里?7. mysql - 分庫分表、分區(qū)、讀寫分離 這些都是用在什么場景下 ,會帶來哪些效率或者其他方面的好處8. 請教使用PDO連接MSSQL數(shù)據(jù)庫插入是亂碼問題?9. 雙擊安裝程序,安裝不了10. mysql - 字符串根據(jù)字典替換
