Macos -在Mac中找不到bash:gulp:command
我尝试在mac中安装gulp,如下所示:Macos -在Mac中找不到bash:gulp:command,macos,bash,npm,gulp,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 安装后,我在终端中看到此错误: npm WARN depreca
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 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
编辑:
我试图通过以下方式发表这一评论:
并查看此错误:
-bash: gulp: command not found
/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
如何修复此问题?我认为您的系统中安装了gulp,或者至少您有一些与gulp相关的文件。只需执行
npm卸载--global-gulp-gulp-cli
,然后尝试使用npm-install--global-gulp-cli
再次安装即可。如果这不起作用,我不知道您的系统上发生了什么。转到
cd /usr/local/bin
ls -las
如果存在gulp,则删除该目录。(sudo rm-右前海湾)重新安装
一饮而尽
===================================================================
如果卸载节点不工作,请完全npm并重试
请按照此链接获取分步指南
我自己刚刚遇到了这个问题,并设法通过以下方式解决了它:
$ npm uninstall --global gulp gulp-cli
$ rm /usr/local/share/man/man1/gulp.1
$ npm install --global gulp-cli
对我来说,只有当我使用
npm
而不是warn
安装gulp
时,它才起作用。非常奇怪。在尝试了所有这些之后,我终于能够安装愚蠢的gulp
npm uninstall --global gulp gulp-cli
yarn global add gulp
@ArchiveVoyageur:谢谢,我尝试了这个,请查看我的编辑。我不确定我是否理解关于
文件存在的不清楚之处,请将其移走,然后重试。
…我想到的唯一一件事是,您可以从系统中安装unistall节点,然后重新安装它。但我对此没有多大希望,因为我不知道你的问题出在哪里。2017年11月为我工作——OSX Sierra。
npm uninstall --global gulp gulp-cli
yarn global add gulp