Windows 10 pro x64
I ran the following commands
npm install --global gulp-cli
npm init
Then I changed directory to my project:
npm install --save-dev gulp
then tried to run gulp and got
-bash: gulp: command not found
my package.json file reads
{
"name": "riad-kilani_v4-child",
"version": "1.0.0",
"description": "",
"main": "gulpfile.js",
"dependencies": {
"gulp-cli": "^1.2.2"
},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-sass": "^2.3.2"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
Any ideas on whats going on here?
The problem might be caused by your global npm directory being set to the wrong location. The global npm directory is where your packages get installed when you install them globally. You can check where it is by typing in npm root -g in the command line.
First run npm -g install gulp-cli then run gulp -v. Alternatively, you can just run npm list gulp.
To install the Gulp CLI globally, on your command line, run npm install gulp-cli -g . The -g flag means npm will install the package in the global npm directory, so you can run the gulp command from any directory.
I solved the problem creating an alias in ~/.bashrc like this:
alias gulp="node /home/deploy/app/node_modules/gulp/bin/gulp.js"
Just put the alias in the end of the .bashrc file, then run:
source ~/.bashrc
Test with:
gulp -v
You should see something like this:
[15:46:39] CLI version 3.9.1
[15:46:39] Local version 3.9.1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With