no command 'gulp' found - after installation

匿名 (未验证) 提交于 2019-12-03 02:45:02

问题:

After installing gulp.js via NPM i receive a no command 'gulp' found error when running the gulp command from the same directory it was installed into.

When looking under the node_modules/.bin/ directory i can see the gulp executable there.

Is there something wrong with my NPM installation?

回答1:

That's perfectly normal. If you want gulp-cli available on the command line, you need to install it globally.

npm install --global gulp-cli 

See the install instruction.

Also, node_modules/.bin/ isn't in your $PATH. But it is automatically added by npm when running npm scripts (see this blog post for reference).

So you could add scripts to your package.json file:

{     "name": "your-app",     "version": "0.0.1",     "scripts": {         "gulp": "gulp",         "minify": "gulp minify"     } } 

You could then run npm run gulp or npm run minify to launch gulp tasks.



回答2:

I actually have the same issue.

This link is probably my best guess:

nodejs vs node on ubuntu 12.04

I did that to resolve my problem:

sudo apt-get --purge remove node  sudo apt-get --purge remove nodejs  sudo apt-get install nodejs sudo ln -s /usr/bin/nodejs /usr/bin/node 


回答3:

I solved the issue without reinstalling node using the commands below:

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


回答4:

I solved the issue removing gulp and installing gulp-cli again:

rm /usr/local/bin/gulp npm install -g gulp-cli 


回答5:

Installing on a Mac - Sierra - After numerous failed attempts to install and run gulp globally via the command line using several different instructions I found I added this to my path and it worked:

export PATH=/usr/local/Cellar/node/7.6.0/libexec/npm/bin/:$PATH 

I got that path from the text output when installing gulp.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!