I did $ npm install gulp -g and I am getting this error
-bash: /usr/local/bin/gulp: No such file or directory
node version:
v5.0.0
I am using OSX.
what could be happening?
as said in the gulp guide you have to install cli and than you need to have gulp in your project dependencies in order to run.
So first:
npm install --global gulp-cli
And than inside your project
npm install --save-dev gulp
I replied to a similar question here
hope this helps
Related
I inside the folder where the project is located through the command:
npm i gulp gulp-sass sass --save-dev
I have installed Gulp, but when I want to run it with this command in vs.code terminal :
gulp
I get an error, I wanted to know what caused the error?
On the system node js 14.1.0 & 16.13.0 and npm are already installed
The error message hints that gulp is not recognized as a command, I don't think this has anything to do with gulp-sass or sass specifically.
Option 1
Install gulp-cli globally:
npm i -g gulp-cli
glup-cli provides the executable gulp command, which will use the version of gulp is installed in your package. This is the preferred way to run gulp.
Option 2
Run gulp directly from your node_modules/.bin folder with the npx command. npx is set up by npm, so there is no need to install any additional packages.
npx gulp
or, equivalently
npm exec gulp
I install gulp with this command npm install gulp -g then I go to my project and install it again npm install --save-dev gulp, and go to my project and created gulpfile.js, I write this simple code only to see if gulp will run or I have an error. This code:
var gulp = require('gulp');
gulp.task('default', function() {
console.log('hello world');
});
Then I go my cmd and write gulp then I have
It might be because you installed the wrong gulp globally. npm install --save-dev gulp should be used on the project, but npm install gulp-cli -g should be the command you use for the global gulp according to the gulp homepage.
From the documentation:
Getting Started
If you've previously installed gulp globally, run npm rm --global
gulp before following these instructions.
Install the gulp command
npm install --global gulp-cli
Install gulp in your devDependencies
Run this command in your project directory:
npm install --save-dev gulp
In my project directory, I installed Grunt by using the following command:
npm install grunt
...after that I did Grunt server in my project directory but it gives me command not found error.
Raj$ grunt server
-bash: grunt: command not found
And:
npm install grunt
npm WARN package.json BID-2.0#0.0.0 No description
npm WARN package.json BID-2.0#0.0.0 No repository field.
npm WARN package.json BID-2.0#0.0.0 No README data
How can I fix it?
You need to install Grunt's command line interface (CLI) globally as well.
From their site:
npm install -g grunt-cli
You may need to use sudo command (for OSX, *nix, BSD etc) or run your command shell as Administrator (for Windows) to do this.
This will put the grunt command in your system path, allowing it to be run from any directory.
You will have to install grunt after installing node / npm with: npm install -g grunt. Then it will be available at the cmd.
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?
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.
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
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
I solved the issue removing gulp and installing gulp-cli again:
rm /usr/local/bin/gulp
npm install -g gulp-cli
if still not resolved try adding this to your package.js scripts
"scripts": { "gulp": "gulp" },
and run npm run gulp
it will runt gulp scripts from gulpfile.js
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.
Tried with sudo and it worked !!
sudo npm install --global gulp-cli
I'm on lubuntu 19.10
I've used combination of previous answers, and didn't tweak the $PATH.
npm uninstall --global gulp gulp-cli
This removes any package if they are already there.
sudo npm install --global gulp-cli Reinstall it as root user.
If you want to do copy and paste
npm uninstall --global gulp gulp-cli && sudo npm install --global gulp-cli
should work
I guess --global is unnecessary here as it's installed using sudo, but I've used it just in case.
in my case there was only on issue, just put "gulp":"gulp" in the script portion, of package.json, and then use command npm run gulp.
I used Homebrew to install Node.js, then used npm install to install Grunt and its dependencies, but after the installation completed, I was not able to run Grunt:
zsh: correct 'grunt' to 'grn' ÆnyaeÅ? n
zsh: command not found: grunt
What is the proper method of installing Grunt so I do not get this error?
To use Grunt on the command line, you have to install the command-line interface:
npm install -g grunt-cli
The -g flag is for installing the module globally, which will also create a PATH variable for Grunt.
npm install -g grunt-cli => This will put the grunt command in your system path