[英]-bash: gulp: command not found in Mac
I try install gulp in mac like this :我尝试像这样在 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
After Install I see this error In terminal:安装后,我在终端中看到此错误:
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
Now when i type gulp
for start/run in terminal i see this error:现在,当我在终端中输入gulp
启动/运行时,我看到了这个错误:
-bash: gulp: command not found
EDIT: I try with this comment By archie-voyageur :编辑:我尝试使用archie-voyageur 的这个评论:
npm install --global gulp-cli
And See this error:并看到这个错误:
/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
How do fix this?如何解决这个问题?
Just came across this issue myself and managed to solve it with:刚刚自己遇到了这个问题并设法解决了它:
$ npm uninstall --global gulp gulp-cli
$ rm /usr/local/share/man/man1/gulp.1
$ npm install --global gulp-cli
go to去
cd /usr/local/bin
ls -las
if gulp is present delete that directory.如果存在 gulp,请删除该目录。 (sudo rm -rf gulp) reinstall gulp-cli (sudo rm -rf gulp) 重新安装 gulp-cli
=================================================================== ================================================== ==================
if it is not working uninstall node, npm completely and try again如果它不起作用卸载节点,请完全 npm 并重试
follow this link for step by step guide按照此链接获取分步指南
I think you have gulp installed in your system, or at least you have some files related to gulp.我认为您的系统中安装了 gulp,或者至少您有一些与 gulp 相关的文件。 Just do npm uninstall --global gulp gulp-cli
and then try to install it again with npm install --global gulp-cli
.只需执行npm uninstall --global gulp gulp-cli
,然后尝试使用npm install --global gulp-cli
再次安装它。 If this doesn't work, I don't know what is happening on your system.如果这不起作用,我不知道您的系统上发生了什么。
After pulling my hair out trying all of these, I ended up being able to install stupid gulp by doing在尝试了所有这些之后,我终于能够通过执行以下操作来安装愚蠢的 gulp
npm uninstall --global gulp gulp-cli
yarn global add gulp
For me it worked only when I installed gulp
using npm
instead of yarn
.对我来说,它只有在我使用npm
而不是yarn
安装gulp
时才有效。 Very weird..很奇怪..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.