Gulp - -猛击:一饮而尽:在Mac中找不到命令

wd2eg0qa  于 2022-12-08  发布在  Gulp
关注(0)|答案(5)|浏览(148)

我试着安装gulp在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 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

现在,当我在终端中输入gulp作为启动/运行时,我看到以下错误:

-bash: gulp: command not found

**编辑:**我尝试与此评论

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

如何解决此问题?

jucafojl

jucafojl1#

我自己也遇到了这个问题,并设法解决了它:

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

bweufnob2#

去找

cd /usr/local/bin
ls -las

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

如果不工作,请卸载节点,完全npm并重试

点击此链接获取逐步指南
node and npm uninstall step by step

41ik7eoe

41ik7eoe3#

我想你的系统中已经安装了gulp,或者至少你有一些与gulp相关的文件,只要执行npm uninstall --global gulp gulp-cli,然后尝试使用npm install --global gulp-cli重新安装即可,如果这样还不起作用,我不知道你的系统中发生了什么。

3phpmpom

3phpmpom4#

在拉我的头发尝试所有这些,我最终能够安装愚蠢的大口做

npm uninstall --global gulp gulp-cli

yarn global add gulp
20jt8wwn

20jt8wwn5#

对我来说,只有当我使用npm而不是yarn安装gulp时,它才起作用。非常奇怪。

相关问题