-bash:gulp:在Mac中找不到命令

ಠ_ಠ*_*ಠ_ಠ 21 macos bash npm gulp

我尝试在mac中安装gulp如下:

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
Run Code Online (Sandbox Code Playgroud)

安装后我在终端中看到此错误:

npm WARN deprecated graceful-fs@3.0.8: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated graceful-fs@1.2.3: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^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
Run Code Online (Sandbox Code Playgroud)

现在当我gulp在终端输入开始/运行时,我看到这个错误:

-bash: gulp: command not found
Run Code Online (Sandbox Code Playgroud)

编辑: 我尝试这个评论由archie-voyageur:

npm install --global gulp-cli
Run Code Online (Sandbox Code Playgroud)

并看到此错误:

/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
Run Code Online (Sandbox Code Playgroud)

怎么解决这个问题?

bin*_*inz 73

刚刚遇到这个问题并设法解决了这个问题:

$ npm uninstall --global gulp gulp-cli
$ rm /usr/local/share/man/man1/gulp.1
$ npm install --global gulp-cli
Run Code Online (Sandbox Code Playgroud)

  • 为我工作2017年11月-OSX Sierra。 (2认同)

小智 8

cd /usr/local/bin
ls -las
Run Code Online (Sandbox Code Playgroud)

如果存在gulp删除该目录.(sudo rm -rf gulp)重新安装gulp-cli

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

如果它不能正常工作卸载节点,请完全重启并重试

按照此链接分步指南

node和npm一步一步卸载


fra*_*osr 0

我认为你的系统中安装了 gulp,或者至少你有一些与 gulp 相关的文件。只需执行此操作npm uninstall --global gulp gulp-cli,然后尝试使用 再次安装它npm install --global gulp-cli。如果这不起作用,我不知道您的系统上发生了什么。