2016-03-09 49 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工作。很奇怪..