2016-03-09 47 views
12

沒有發現我嘗試在Mac上安裝一飲而盡這樣的:-bash:一飲而盡:命令在Mac

Is-iMac:~ itop$ npm root 
/Users/itop/node_modules 
Is-iMac:~ itop$ npm config set prefix /usr/local 
Is-iMac:~ itop$ npm root -g 
/usr/local/lib/node_modules 
Is-iMac:~ itop$ sudo npm install -g gulp 

安裝後,我看到這個錯誤在終端:

npm WARN deprecated [email protected]: graceful-fs version 3 and before will fail on newer node releases. Please update to [email protected]^4.0.0 as soon as possible. 
npm WARN deprecated [email protected]: [email protected]<3.0.0 is no longer maintained. Upgrade to [email protected]^4.0.0. 
npm WARN deprecated [email protected]: graceful-fs version 3 and before will fail on newer node releases. Please update to [email protected]^4.0.0 as soon as possible. 
npm ERR! Darwin 15.3.0 
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "gulp" 
npm ERR! node v5.6.0 
npm ERR! npm v3.8.0 
npm ERR! path /usr/local/bin/gulp 
npm ERR! code EEXIST 

npm ERR! Refusing to delete /usr/local/bin/gulp: ../lib/node_modules/gulp-cli/bin/gulp.js symlink target is not controlled by npm /usr/local 
npm ERR! File exists: /usr/local/bin/gulp 
npm ERR! Move it away, and try again. 

npm ERR! Please include the following file with any support request: 
npm ERR!  /Users/it/npm-debug.log 

現在,當我鍵入gulp用於啓動/在終端上運行我看到此錯誤:

-bash: gulp: command not found 

編輯: 我嘗試這條評論通過archie-voyageur

npm install --global gulp-cli 

,看到這樣的錯誤:

/usr/local/bin/gulp -> /usr/local/lib/node_modules/gulp-cli/bin/gulp.js 
npm ERR! Darwin 15.3.0 
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--global" "gulp-cli" 
npm ERR! node v5.6.0 
npm ERR! npm v3.8.0 
npm ERR! path /usr/local/share/man/man1/gulp.1 
npm ERR! code EEXIST 

npm ERR! Refusing to delete /usr/local/share/man/man1/gulp.1: ../../../lib/node_modules/gulp/gulp.1 symlink target is not controlled by npm /usr/local 
npm ERR! File exists: /usr/local/share/man/man1/gulp.1 
npm ERR! Move it away, and try again. 

npm ERR! Please include the following file with any support request: 
npm ERR!  /Users/itop/npm-debug.log 

如何解決這個問題?

+0

@ArchieVoyageur:謝謝,我試試這個請看看我的編輯。 –

+0

我不知道如果我明白了什麼是不清楚'文件存在,將其移開,並嘗試again.' .... – Carpetsmoker

回答

1

我想你已經吞掉安裝在系統中,或者至少你要吞掉相關的一些文件。只要做到npm uninstall --global gulp gulp-cli,然後嘗試用npm install --global gulp-cli重新安裝。如果這不起作用,我不知道你的系統上發生了什麼。

+0

我試試,看看同樣的錯誤。 –

+0

來我的頭,你唯一能做的事情就是從系統中反安裝節點,並從頭開始重新安裝。但是,我沒有太多的希望,因爲我不知道是什麼阻止了你的問題。 – franmartosr

4

轉到

cd /usr/local/bin 
ls -las 

if gulp is present delete that directory. (sudo rm -rf gulp) reinstall gulp-cli

================================ ===================================

如果它不工作卸載節點,NPM完全並重試

follow this link for step by step guide

node and npm uninstall step by step

43

過這個問題,剛來到自己和管理,以解決該問題:

$ npm uninstall --global gulp gulp-cli 
$ rm /usr/local/share/man/man1/gulp.1 
$ npm install --global gulp-cli 
+2

這解決了我長期存在的問題,應該在頂級的IMO! – colinmcp

+1

爲我效勞2017年11月 - OSX Sierra。 – richtelford

+0

@binz謝謝你! – user1242321

0

對我來說,只有當我使用npm代替yarn安裝gulp工作。很奇怪..