0

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.

3
  • Did you check those folders ? Commented Jun 14, 2018 at 22:21
  • You also need to install gulp globally (as well as locally, which you did). Commented Jun 14, 2018 at 22:25
  • There 2 gulp files in C:\Program Files\Git\Roaming\npm\ There are also 2 gulp folders in C:\Program Files\Git\Roaming\npm\node_modules I am still getting the message the command not found message Commented Jun 15, 2018 at 0:45

3 Answers 3

2

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.

  1. Create an environmental variable called NODE_PATH
  2. Set it to: %AppData%\npm ( It's you npm path )
  3. Close CMD, and Re-Open to get the new ENV variables
Sign up to request clarification or add additional context in comments.

10 Comments

I added that variable under my user variables. I restarted my CMD and it is still installing new global packages into C:\Program Files\Git\Roaming\npm\
npm ls gave me C:\Program Files\Git --empty npm ls -g game me C:\Program Files\Git\Roaming\npm npm link gulp returned an error for the path C:\Program Files\Git\node_modules
Did you check npm ls and npm ls -g ? @SteveGreco
yes. Those commands both returned C:\Program Files\Git and C:\Program Files\Git\node_modules respectively.
we don't need path. find gulp in output list @SteveGreco
|
1

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 ')
})

1 Comment

Nice. No need to install gulp or gulp-cli globally.
0

This worked for me:

npm config delete prefix

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.