Gulp not recognized in command prompt despite updated added path variable - node.js

I installed gulp following the standard procedure:
$ npm install --global gulp-cli
adding the project dev dependency
$ npm install --save-dev gulp
and a gulpfile.js
When running gulp from Git Bash I get the error gulp: command not found
I followed related threads here on SO updating my path variable (Windows 7) with C:\Users\username\AppData\Roaming\npm to no avail
I actually didn't find any gulp folders inside C:\Users\username\AppData\Roaming\npm (other packages are still there and function as expected). Instead, gulp seems to get installed to C:\Program Files\Git\usr\local
Running npm root and npm root -g respectively, return
C:\Users\username\node_modules and
C:\Program Files\Git\usr\local\node_modules
I also got the following warnings when running npm install --save-dev gulp
I feel like I mixed up paths somehow, but I'm a bit lost, as I'm new to Node and Gulp.

After open command shell with administrator simply write npm install -g gulp and npm install -g gulp-cli. You can reach from every location to gulp then.

Related

How to resolve this gulp watch issue [duplicate]

I am trying to start my angular app using grunt serve command
but I am getting Fatal error: spawn cmd ENOENT.
I used following commands to generate my Angular App
npm install -g yo grunt-cli bower
npm install -g generator-angular
yo angular
npm install
bower install
then i used grunt serve command to start my app
but its not working.
System Info:
OS: Windows 7 64 bit
npm version : 2.11.3
please help me, I gone through all the grunt documentation but no clue.
Try the following possible solutions:
Verify the npm folder exists at the following location C:\Users\My-UserName\AppData\Roaming\npm
Try to run npm cache clean
Add C:\Windows\System32\ to the PATH Environment variable
Run grunt serve with cmd.exe instead of git bash. I have the same problem and have dealt with it in this way.

Gulp Command not being found

I have attempted to install Gulp using NPM but the gulp command is not getting recognized. These are the commands I ran. I am using Git Bash and running it as admin. I am using Windows 10.
npm install gulp-cli --global
( Attempt to run 'gulp' and 'gulp -v' and nothing works )
Then navigating to my project folder
npm install gulp --save-dev
( Attempt Gulp command again and it still not recognized )
My env path for npm is C:\Users\ *username* \AppData\Roaming\npm
When I run
npm config get prefix
It returns C:\Program Files\Git\Roaming\npm
I am fairly new to NPM but I have been searching for hours and trying everything. I have uninstalled and reinstalled Node and npm multiple times. Sorry if this has been answered before but every other thread I found did not solve this issue.
Install gulp and gulp-cli globally
npm install --global gulp-cli
npm install --global gulp
npm install gulp -D
Update:
Make sure install gulp locally and globally. After that check status using these command :
npm ls
npm ls -g
After that make sure to link gulp
npm link gulp
And maybe you should check you env.
Create an environmental variable called NODE_PATH
Set it to: %AppData%\npm ( It's you npm path )
Close CMD, and Re-Open to get the new ENV variables
Add gulp to scripts in your package.json file:
"scripts": {
"gulp":"gulp"
},
Then you can use the command:
npm run gulp name of task
Writing function like this worked for me:
gulp.task('message', async ( ) => {
console.log('gulp task is working ')
})
This worked for me:
npm config delete prefix

npm install from package.json, the dependancy -v yields command not found

Reinstalled node/npm from scratch and after npm install I can see the node_modules folder with all of the content from package.json. Checking gulp -v gives command not found in the command line on a mac. If I install gulp globally, gulp -v yields the version.
Is there a way of not installing all dependancies globally to use?
Generally gulp is a package which is used to run some task. These task might need to have administrator privileges. So it is better to install it globally using "npm install -g gulp" command. Here -g means "install it globally".
npm install installs the package locally.

Grunt is not recognised : windows7 64-bit

I have installed npm and installed grunt, but when i run grunt, it says 'grunt' is not recognized as an internal or external command.
I done the below steps in command prompt
npm install
npm install -g grunt-cli
PATH variable and grunt folder are available but still i am not able to run grunt.
Please provide me a solution for this
You have only installed the command line interface.
Use npm install -g grunt to install the actual program.

Getting grunt command not working

All the npm installs gave errors and warnings but would say "Everything is ok" at the end.
When I tried grunt serve, I got these warnings.
>> Local Npm module "grunt-contrib-connect" not found. Is it installed?
>> Local Npm module "grunt-contrib-watch" not found. Is it installed?
>> Local Npm module "grunt-contrib-htmlmin" not found. Is it installed?
>> Local Npm module "grunt-contrib-cssmin" not found. Is it installed?
>> Local Npm module "grunt-contrib-uglify" not found. Is it installed?
>> Local Npm module "grunt-bower-requirejs" not found. Is it installed?
>> Local Npm module "grunt-eslint" not found. Is it installed?
>> Local Npm module "grunt-jscs" not found. Is it installed?
How do I fix it?
Are you installing on a Mac or Windows?
First, make sure the Grunt Client is installed within your directory:
$ npm install -g grunt-cli
Then:
$ npm install grunt-serve
Further documentation of installation can be found here:
https://www.npmjs.org/package/grunt-serve
Try as below:
1) npm install -g grunt-cli
This will put the grunt command in your system path, allowing it to be run from any directory.
Note that installing grunt-cli does not install the Grunt task runner! The job of the Grunt CLI is simple: run the version of Grunt which has been installed next to a Gruntfile. This allows multiple versions of Grunt to be installed on the same machine simultaneously.
2) npm install grunt --save-dev
3) npm install grunt-serve
The easiest way to add Grunt and gruntplugins to an existing package.json is with the command npm install --save-dev. Not only will this install locally, but it will automatically be added to the devDependencies section, using a tilde version range.
for further assistance follow this link
http://gruntjs.com/getting-started

Resources