I’ve installed gulp both globally and locally using
npm install gulp
npm install gulp -g
npm install gulp-util
npm install gulp-util -g
When try to run gulp i get
'gulp' is not recognized as an internal or external command, operable program or batch file.
Running npm list gulp (or -g), I gulp@3.7.0
with the location of either my global or local gulp installation.
I’ve tried running node gulpfile.js
pointed to my gulpfile, and it runs without error, and of course, it starts with require('gulp')
.
Any suggestions on getting gulp working on Windows(8.1)?
asked Jun 4, 2014 at 1:23
pedalpetepedalpete
20.9k44 gold badges128 silver badges237 bronze badges
8
You forgot to install the gulp-cli package:
npm install -g gulp-cli
Then you can run the command «gulp» from the command line.
answered Feb 7, 2016 at 21:23
4
The issue and answer can be found in this question: https://stackoverflow.com/a/9588052/1041104
The npm modules such as gulp are not installed to the path. Thus are not found when you run them in the CMD.
If gulp has been installed globally, you can use the process below:
- Create an environmental variable called
NODE_PATH
- Set it to:
%AppData%npmnode_modules
or%AppData%npm
on windows 8-10 - Close CMD, and Re-Open to get the new ENV variables
Running npm ls
and npm ls -g
shows that they are installed, but the CMD can not find them due to the missing link
.
answered Jun 4, 2014 at 16:37
SteveLacySteveLacy
4,1102 gold badges24 silver badges30 bronze badges
11
- Be sure that you have gulp and
gulp.cmd
(use windows search) - Copy the path of
gulp.cmd
(C:UsersXXXXAppDataRoamingnpm
) - Add this path to the Path envirement variable or edit
PATH
environment variable and add%APPDATA%npm
- Reopen cmd.
Add %APPDATA%npm
to front of Path, not end of the Path.
H. Pauwelyn
13.1k26 gold badges80 silver badges140 bronze badges
answered Dec 4, 2014 at 13:23
3
-
Install gulp globally.
npm install -g gulp
-
Install gulp locally in the project.
npm install gulp
-
Add below line in your package.json
"scripts": {
"gulp": "gulp"
} -
Run gulp.
npm run gulp
This worked for me.
ketan
18.9k42 gold badges60 silver badges94 bronze badges
answered Sep 14, 2015 at 16:34
Gaurav GoelGaurav Goel
5714 silver badges2 bronze badges
4
I am using Windows 8.1. I had the same problem.
I installed gulp using Node.js command prompt
npm install -g gulp
Then go to the required directory in Node.js command prompt and try
gulp -v
If you get gulp local version not found exit the current Node.js command prompt and try the above command in a new Node.js command prompt
I tried the NODE_PATH mentioned by @SteveLacy but the command prompt was still not able to detect gulp command
answered Sep 9, 2014 at 17:47
Sudarsan GPSudarsan GP
1,19414 silver badges22 bronze badges
6
Had the same problem, not really best solution but install it globally:
npm install -g gulp
Of course it’s best to still have it in package.json
, so you can do the following to install it locally and add an entry into package.json
:
npm install --save-dev gulp
Everything else (gulp plugins) install also locally.
answered Sep 8, 2014 at 7:41
NamekNamek
1,1821 gold badge13 silver badges28 bronze badges
0
The simple solution just do npm link gulp
answered Jun 18, 2017 at 10:34
miojamomiojamo
7212 gold badges14 silver badges31 bronze badges
2
I was having the same problem when trying to get gulp working on a co-workers VM. It seems the problem stems from the users folder.
Adding NODE_PATH in my environment variables didn’t fix the problem.
If you edit your ‘Path’ variable in your system variables and add ‘%APPDATA%npm’ at the end of that, it should fix the problem… Unless you or somebody else npm installed gulp as another user than the one you’re currently logged in as.
If you want it to be available for all users, put ‘C:UsersyourUserAppDataRoamingnpm'(or where ever you have gulp) explicitly instead of using ‘%APPDATA%npm’. You can also move the files to a more user-indifferent path.
Don’t forget to start a new cmd prompt, because the one you have open won’t get the new ‘Path’ variable automatically.
Now ‘gulp’.
answered May 14, 2015 at 19:46
SpacemanSpaceman
1911 silver badge4 bronze badges
One right way:
- Cmd + R : type «%appdata%»
- Go to npm folder
- Copy whole path like «C:UsersBlah…npm»
- Go to My Computer + Right Click «Properties»
- Advanced System Settings (On the left)
- Click on Environment Variables
- Click on Edit Path
- Add that «C:UsersBlah…npm» to the end and type «;» after that
- Click ok and reopen cmd
answered Jul 13, 2015 at 23:37
yeralinyeralin
1,33713 silver badges23 bronze badges
3
You should first install gulp
as global using:
npm install gulp -g
Otherwise the path solution will not resolve the problem.
Then add the npm modules path to the PATH using:
PATH = %PATH%;%APPDATA%npm
answered Jan 1, 2017 at 23:31
Badr BellajBadr Bellaj
10.5k2 gold badges39 silver badges39 bronze badges
2
In my case it was that I had to install
gulp-cli by command npm -g install gulp-cli
answered Sep 17, 2018 at 10:14
Skylin RSkylin R
1,9711 gold badge19 silver badges23 bronze badges
0
Try to add to your PATH variable the following:
C:UsersYOUR_USERAppDataRoamingnpm
I had the same problem and I solved adding the path to my node modules.
answered Dec 11, 2014 at 17:09
JC GomezJC Gomez
1011 silver badge2 bronze badges
I had a similar problem setting it up in windows 10. My answer is windows specific (look at the answers for modifying path in bash for a linux or OSX solution)
The core problem I had was that npm’s folder was not registered in the path.
I originally tried changing this in cmd prompt.
setx path "%path%;%appdata$npm"
Note that I used setx instead of set to ensure that the update to the environmental variable remains. Also note that it’s a backslash.
This should work but for me it didn’t because setx has a limit of only accepting 1024 characters… (yes it’s nonsensical to me as well).
So try the above and if you get a warning like did about reaching the 1024 limit, then you can do the other way I ended up doing.
First while youre still in the console, type: echo %appdata%npm
… this is your npm folder that you want to add to the path so add it to your clipboard.
You have to go into the registry and reach the following folder:
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironment
Then append the ‘Path’ value with the npm folder path in your clipboard. Reboot to activate the new value and you should now be good to go.
Finally, just test it all out
>npm install -g gulp
>gulp
answered Apr 19, 2016 at 21:10
ThinkBonoboThinkBonobo
14.8k8 gold badges58 silver badges80 bronze badges
5
This ended up being a ‘user’ issue with me. I had installed npm and node on the system logged in as user1, then I set-up user2. I could run node, and I could run npm commnds, but could not run any npm packages from the command line.
I uninstalled node and npm, and reinstalled under the correct user in order to solve the problem. After that I can run packages from the command-line without issue.
answered Jul 1, 2014 at 3:25
pedalpetepedalpete
20.9k44 gold badges128 silver badges237 bronze badges
1
The top answer did not work for me.
I am using a virtual machine that had a previous owner. The previous owner had an old version of npm installed. Using that, I was installed gulp globally with npm install -g gulp
. Running the command gulp
would return 'gulp' is not recognized as an internal or external command, operable program or batch file.
. As I said, the top Answer did not fix my problem. I basically had to reinstall nodejs.
Solution
- Re-download nodejs
npm install -g gulp
gulp -version
This fixed the problem for me.
answered Jul 1, 2016 at 23:15
christo8989christo8989
6,1465 gold badges34 silver badges42 bronze badges
3
I had v0.12.3 of Nodejs on Win7 x64 and ran into similar issues when I tried installing gulp. This worked for me:
- Uninstalled Nodejs
- Installed Nodejs v0.10.29
- npm install -g npm
- npm install -g gulp
answered May 17, 2015 at 11:05
kmxrkmxr
4493 silver badges4 bronze badges
2
The NodeJS installer appears to add the user/AppData/Roaming/npm path to the user environment path, which is appropriate.
Normally, the PATH environment variable at the command line is the combination of the user environment path and the system environment path.
However, if the user environment path + the system environment path is larger than about 1920 characters, Windows does not not combine the user and system paths — only the system environment path is used.
See: https://stackoverflow.com/a/21270921/301152
So, when you open the Advanced System Settings in Windows to edit your environment variables, take a look to see if the user/AppData/Roaming/npm path is already in your user environment PATH. If it is, then the problem is that your user + system paths are too long, causing Windows to ignore your user path. Trim your user and/or system path strings and gulp should work as installed.
If you can’t find anything to trim away from your user and system paths, then add the user/AppData/Roaming/npm path to the system environment path and call it a hack.
answered Dec 2, 2015 at 0:48
dthorpedthorpe
35.1k5 gold badges74 silver badges119 bronze badges
1
I was facing the same problem after installation. So i tried running cmd
with elevated privileges (admin) and it worked.
Screen capture:
Rohit416
3,3463 gold badges25 silver badges41 bronze badges
answered Jun 3, 2016 at 9:36
3
Add this path in your Environment Variables PATH
C:UsersUSERNAMEAppDataRoamingnpm
answered Jul 19, 2016 at 13:49
Kranti123Kranti123
1992 gold badges3 silver badges14 bronze badges
(Windows 10) I didn’t like the path answers. I use choco package manager for node.js. Gulp would not fire for me unless it was:
-
Globally installed
npm i -g gulp
and local dirnpm i --save-dev gulp
-
The problem persisted beyond this once, which was fixed by completely removing node.js and reinstalling it.
I didn’t see any comments about local/global and node.js removal/reinstall.
answered Jun 2, 2018 at 15:32
This is most commonly because it is not found on environment variables as others have pointed out. This is what worked for me.
echo %PATH%
This will show you what’s one your PATH environment variable. If node_modules is not there there do the following to add it from your APPDATA path.
PATH = %PATH%; %APPDATA%npm
answered Aug 17, 2015 at 4:39
IlluminatiIlluminati
4,4812 gold badges35 silver badges55 bronze badges
1
I resolved it by adding
C:Users[USER]AppDataRoamingnpm
to PATH
and not
C:Users[USER]AppDataRoamingnpmnode_modules
answered Oct 8, 2015 at 10:05
1
I already had the one condition from this answer (I don’t know why)
https://stackoverflow.com/a/27295145/1175496
That is, my PATH already included %APPDATA%npm
In my case, the problem was npm was not installing modules there (again, I don’t know why)
Therefore I needed to do this:
$ npm config set prefix -g %APPDATA%/npm
After that, running
$ npm install -g gulp
(or installing any other module) put the module in the place where PATH expects it.
answered Dec 22, 2015 at 22:59
The Red PeaThe Red Pea
16.7k18 gold badges96 silver badges127 bronze badges
This works for me:
npm link gulp
npm update
answered Jan 4, 2016 at 11:21
vineetvineet
13.5k10 gold badges53 silver badges76 bronze badges
1
On my Windows 10 Enterprise, gulp was not installed in %AppData%, which is C:UsersusernameAppDatanpmnode_modules on my machine, but in C:UsersusernameAppDataLocalnpmnode_modules.
To get gulp to be picked up at the command prompt or in powershell, I added to the user PATH the value C:UsersusernameAppDataLocalnpm. After that it worked like a charm. Naturally I had to close the command prompt or powershell window and re-open for the above to take effect.
answered May 2, 2018 at 14:58
0
Had gulp command not found problem in windows 10 and Adding «%AppData%npmnode_modules» doesn’t work for me.
Do this steps please:
After doing
npm install -g npm
And
npm install -g gulp
Add
C:UsersYourUsernamenpm
to Path in System Variables.
It Works for me after all solutions failed me.
answered Aug 16, 2015 at 11:02
A. NajafiA. Najafi
1031 gold badge1 silver badge4 bronze badges
Run npm install gulp -g
if you are using windows, please add the gulp’s dir to PATH.
such like C:UsersYOURNAMEAppDataRoamingnpmnode_modulesgulp
answered Dec 21, 2015 at 12:54
In windows:
- Using your windows explorer, Navigate to your vagrant shared folder (I am using scotchbox by the way) e.g
C:scotchbox/public/gulpProject
- In the address bar of the folder, type
cmd
and press Enter - Do your gulp installation
npm install
Tunaki
130k45 gold badges326 silver badges414 bronze badges
answered Jan 4, 2016 at 8:51
In short:
You should add %NODE_PATH%
to the system variable Path
if the other answers don’t work.
The reason:
The point is, command prompt only executes programs under the Path
system variable, not the user variables. If you have NODE_PATH
set as a user variable, add %NODE_PATH%
to Path
.
I asked here and got marked duplicate for a question with different intention
NPM Windows doesn’t execute program under the User Variable path [duplicate]
answered Jan 22, 2016 at 14:02
Daniel CheungDaniel Cheung
4,7211 gold badge31 silver badges62 bronze badges
In Windows:
- Press the following two keys: Windows + r
- Type
control /name microsoft.system
into the run dialog box that appears from the previous step.
- Select Advanced System Settings from the left of the window pane
- Click the Advanced tab on the system properties box that appears and click the Environment Variables button.
- Edit the
PATH
User environment variable. - Click New on the edit environment variable window that pops up for the
PATH
variable and add the following:%APPDATA%npm
to the start of thePATH
environment variable (as shown in the image below).
- Close your Command Prompt and reopen it.
answered Jun 6, 2016 at 3:58
JSON C11JSON C11
10.8k7 gold badges79 silver badges64 bronze badges
gulp tutorials tag — gulp , gulp sass , gulp watch , gulp meaning , gulp js , gulp uglify , concat javascript , eisi gulp , gulp concat , gulp install , gulp tutorial , what is gulp , npm install gulp , gulpjs
How to re-run the gulp command?
- You ran the following command for installing Gulp (a node package module) globally:
npm install -g gulp
Clicking «Copy Code» button will copy the code into the clipboard — memory. Please paste(Ctrl+V) it in your destination. The code will get pasted. Happy coding from Wikitechy — gulp tutorial — gulp guides — gulp — rubyonrails — learn gulp — team
- The installation succeed but when you ran this gulp command in the command line you got a «gulp: command not found» error.
- It looks like that installed “Gulp” in your local folder that is /Users/YOURUSERNAME/node_modules and not in the global NPM folder.
- You can check this by running this command: npm root or npm root -g, which was returning my personal directory /Users/YOURUSERNAME/node_modules and not the expected /usr/local/lib/node_modules.
- After some trial & error, finally found the solution. You have to change the “npm config prefix” like so: npm config set prefix /usr/local
- Then when you re-ran npm root -g, you got the correct root folder: /usr/local/lib/node_modules
- When you reinstalled Gulp globally (with the -g param) it finally worked and appeared that it was now correctly installed in the global NPM folder.
learn gulp tutorial — gulp command not found — gulp example
For Example
rickys-MacBook-Pro-2:laravel5-demo-project rickyspires$
$ sudo npm -g install [email protected]
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
[email protected] /usr/local/lib/node_modules/npm
$ sudo npm install gulp --no-bin-link
[email protected] node_modules/gulp
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected],
[email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected],
[email protected], [email protected], [email protected],
[email protected], [email protected], [email protected], [email protected],
[email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected],
[email protected], [email protected], [email protected], [email protected])
$ gulp
-bash: gulp: command not found
$ gulp watch
-bash: gulp: command not found
Clicking «Copy Code» button will copy the code into the clipboard — memory. Please paste(Ctrl+V) it in your destination. The code will get pasted. Happy coding from Wikitechy — gulp tutorial — gulp guides — gulp — rubyonrails — learn gulp — team
gulp tutorials tag — gulp , gulp sass , gulp watch , gulp meaning , gulp js , gulp uglify , concat javascript , eisi gulp , gulp concat , gulp install , gulp tutorial , what is gulp , npm install gulp , gulpjs , gulp serve , npm gulp , gulp less , npm save dev , gulp imagemin , gulp clean , gulp livereload , gulp command not found , gulp dest , gulp copy , npm watch , gulp build , gulp connect , npm sass , gulp if , gulp scss , gulp minify js , browserify gulp , gulp jshint , gulp pipe , npm install save dev , npm install dev gulped meaning , js uglify , gulp bower , gulp plugins , gulp definition , gulp start , compilation pipe , gulp changed , install gulp windows , gulp npm , gulp cli , gulp angular , gulp run , gulp version , gulp wiki , gulp file , define gulp , gulp path , run gulp , typescript gulp , gulp concat css , javascript pipe , sass gulp , install gulp ubuntu , what is gulp js , gulp command
If you use Gulp to run tasks, have you ever tried to run gulp
on the command line, but gotten an error that says: gulp: command not found
?
Why is this happening?
Well, in order to run a package on your command line from any directory, it needs to be installed globally on your computer.
Here are a couple of fixes for this problem:
Install the gulp-cli globally
To run Gulp, you need two things:
- The Gulp CLI needs to be installed globally,
- And Gulp needs to be installed locally in the directory for each project it is used on.
So before trying to install Gulp in your project directory, you must first install the Gulp CLI globally. You can do this by typing in npm install gulp-cli -g
.
Then you can install Gulp in the specific project directory by typing in npm install gulp
.
Check that you have npm installed in the /usr/local directory
Are you still getting the error even if you have the Gulp CLI installed globally?
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.
On PC, the directory might be: C:UsersYOURNAMEAppDataRoamingnpmnode_modules
On a Mac, it should be something like: /usr/local/lib/node_modules/
For Mac users, if the root
command returns a directory like /Users/YOURNAME/node_modules
then this will cause the command not found
error.
To fix it, you can change what your npm root folder is set to by running: npm config set prefix /usr/local
Then you should be able to install the Gulp CLI globally and Gulp locally.
Want to learn how to build a website?
I’m making a course that will teach you how to build a real-world responsive website from scratch!
Learn more
I’m running git-bash on windows. I feel the issue I’m facing is more of a NIX geared question than windows. I have a shell script:
build.sh
myProject="../myProject/"
build="gulp build"
cd "${myProject}"
pwd
"${build}"
When I run this script I get error
gulp build: command not found
When I run «gulp build» directly in the shell, running these same commands by hand then everything works. I tried executing the script via:
. build.sh
and just build.sh
Same error either way. How can I run a script that can access gulp/npm? Why does this fail even when I am sourcing the script?
asked Mar 18, 2016 at 13:33
P.Brian.MackeyP.Brian.Mackey
1,6013 gold badges14 silver badges20 bronze badges
1
Quoting "${build}"
prevents word splitting, so it has the same effect here as writing "gulp build"
(with quotes), which would search for an executable called gulp build
with a space inside the name; and not as writing gulp build
, which executes gulp
with a build
argument.
Concluding, the last line of your script should be:
${build}
answered Mar 18, 2016 at 13:44
Do not quote "${build}"
. As it expects in such a case gulp build
command (with a space inside) and reports rightfully such command does not exist.
Execute simply by ${build}
. Then shell will treat it as a command and arguments.
myProject="../myProject/"
build="gulp build"
cd "${myProject}"
pwd
${build}
answered Mar 18, 2016 at 13:38
techraftechraf
5,64710 gold badges33 silver badges50 bronze badges
2
I’ve installed gulp both globally and locally using
npm install gulp
npm install gulp -g
npm install gulp-util
npm install gulp-util -g
When try to run gulp i get
'gulp' is not recognized as an internal or external command, operable program or batch file.
Running npm list gulp (or -g), I [email protected]
with the location of either my global or local gulp installation.
I’ve tried running node gulpfile.js
pointed to my gulpfile, and it runs without error, and of course, it starts with require('gulp')
.
Any suggestions on getting gulp working on Windows(8.1)?
30 Answers
You forgot to install the gulp-cli package:
npm install -g gulp-cli
Then you can run the command «gulp» from the command line.
The issue and answer can be found in this question: https://stackoverflow.com/a/9588052/1041104
The npm modules such as gulp are not installed to the path. Thus are not found when you run them in the CMD.
If gulp has been installed globally, you can use the process below:
- Create an environmental variable called
NODE_PATH
- Set it to:
%AppData%npmnode_modules
or%AppData%npm
on windows 8-10 - Close CMD, and Re-Open to get the new ENV variables
Running npm ls
and npm ls -g
shows that they are installed, but the CMD can not find them due to the missing link
.
- Be sure that you have gulp and
gulp.cmd
(use windows search) - Copy the path of
gulp.cmd
(C:UsersXXXXAppDataRoamingnpm
) - Add this path to the Path envirement variable or edit
PATH
environment variable and add%APPDATA%npm
- Reopen cmd.
Add %APPDATA%npm
to front of Path, not end of the Path.
-
Install gulp globally.
npm install -g gulp
-
Install gulp locally in the project.
npm install gulp
-
Add below line in your package.json
"scripts": {
"gulp": "gulp"
} -
Run gulp.
npm run gulp
This worked for me.
I am using Windows 8.1. I had the same problem.
I installed gulp using Node.js command prompt
npm install -g gulp
Then go to the required directory in Node.js command prompt and try
gulp -v
If you get gulp local version not found exit the current Node.js command prompt and try the above command in a new Node.js command prompt
I tried the NODE_PATH mentioned by @SteveLacy but the command prompt was still not able to detect gulp command
Had the same problem, not really best solution but install it globally:
npm install -g gulp
Of course it’s best to still have it in package.json
, so you can do the following to install it locally and add an entry into package.json
:
npm install --save-dev gulp
Everything else (gulp plugins) install also locally.
The simple solution just do npm link gulp
I was having the same problem when trying to get gulp working on a co-workers VM. It seems the problem stems from the users folder.
Adding NODE_PATH in my environment variables didn’t fix the problem.
If you edit your ‘Path’ variable in your system variables and add ‘%APPDATA%npm’ at the end of that, it should fix the problem… Unless you or somebody else npm installed gulp as another user than the one you’re currently logged in as.
If you want it to be available for all users, put ‘C:UsersyourUserAppDataRoamingnpm'(or where ever you have gulp) explicitly instead of using ‘%APPDATA%npm’. You can also move the files to a more user-indifferent path.
Don’t forget to start a new cmd prompt, because the one you have open won’t get the new ‘Path’ variable automatically.
Now ‘gulp’.
One right way:
- Cmd + R : type «%appdata%»
- Go to npm folder
- Copy whole path like «C:UsersBlah…npm»
- Go to My Computer + Right Click «Properties»
- Advanced System Settings (On the left)
- Click on Environment Variables
- Click on Edit Path
- Add that «C:UsersBlah…npm» to the end and type «;» after that
- Click ok and reopen cmd
You should first install gulp
as global using:
npm install gulp -g
Otherwise the path solution will not resolve the problem.
Then add the npm modules path to the PATH using:
PATH = %PATH%;%APPDATA%npm
In my case it was that I had to install
gulp-cli by command npm -g install gulp-cli
Try to add to your PATH variable the following:
C:UsersYOUR_USERAppDataRoamingnpm
I had the same problem and I solved adding the path to my node modules.
I had a similar problem setting it up in windows 10. My answer is windows specific (look at the answers for modifying path in bash for a linux or OSX solution)
The core problem I had was that npm’s folder was not registered in the path.
I originally tried changing this in cmd prompt.
setx path "%path%;%appdata$npm"
Note that I used setx instead of set to ensure that the update to the environmental variable remains. Also note that it’s a backslash.
This should work but for me it didn’t because setx has a limit of only accepting 1024 characters… (yes it’s nonsensical to me as well).
So try the above and if you get a warning like did about reaching the 1024 limit, then you can do the other way I ended up doing.
First while youre still in the console, type: echo %appdata%npm
… this is your npm folder that you want to add to the path so add it to your clipboard.
You have to go into the registry and reach the following folder:
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironment
Then append the ‘Path’ value with the npm folder path in your clipboard. Reboot to activate the new value and you should now be good to go.
Finally, just test it all out
>npm install -g gulp
>gulp
This ended up being a ‘user’ issue with me. I had installed npm and node on the system logged in as user1, then I set-up user2. I could run node, and I could run npm commnds, but could not run any npm packages from the command line.
I uninstalled node and npm, and reinstalled under the correct user in order to solve the problem. After that I can run packages from the command-line without issue.
The top answer did not work for me.
I am using a virtual machine that had a previous owner. The previous owner had an old version of npm installed. Using that, I was installed gulp globally with npm install -g gulp
. Running the command gulp
would return 'gulp' is not recognized as an internal or external command, operable program or batch file.
. As I said, the top Answer did not fix my problem. I basically had to reinstall nodejs.
Solution
- Re-download nodejs
npm install -g gulp
gulp -version
This fixed the problem for me.
I had v0.12.3 of Nodejs on Win7 x64 and ran into similar issues when I tried installing gulp. This worked for me:
- Uninstalled Nodejs
- Installed Nodejs v0.10.29
- npm install -g npm
- npm install -g gulp
The NodeJS installer appears to add the user/AppData/Roaming/npm path to the user environment path, which is appropriate.
Normally, the PATH environment variable at the command line is the combination of the user environment path and the system environment path.
However, if the user environment path + the system environment path is larger than about 1920 characters, Windows does not not combine the user and system paths — only the system environment path is used.
See: https://stackoverflow.com/a/21270921/301152
So, when you open the Advanced System Settings in Windows to edit your environment variables, take a look to see if the user/AppData/Roaming/npm path is already in your user environment PATH. If it is, then the problem is that your user + system paths are too long, causing Windows to ignore your user path. Trim your user and/or system path strings and gulp should work as installed.
If you can’t find anything to trim away from your user and system paths, then add the user/AppData/Roaming/npm path to the system environment path and call it a hack.
I was facing the same problem after installation. So i tried running cmd
with elevated privileges (admin) and it worked.
Screen capture:
Add this path in your Environment Variables PATH
C:UsersUSERNAMEAppDataRoamingnpm
(Windows 10) I didn’t like the path answers. I use choco package manager for node.js. Gulp would not fire for me unless it was:
-
Globally installed
npm i -g gulp
and local dirnpm i --save-dev gulp
-
The problem persisted beyond this once, which was fixed by completely removing node.js and reinstalling it.
I didn’t see any comments about local/global and node.js removal/reinstall.
This is most commonly because it is not found on environment variables as others have pointed out. This is what worked for me.
echo %PATH%
This will show you what’s one your PATH environment variable. If node_modules is not there there do the following to add it from your APPDATA path.
PATH = %PATH%; %APPDATA%npm
I resolved it by adding
C:Users[USER]AppDataRoamingnpm
to PATH
and not
C:Users[USER]AppDataRoamingnpmnode_modules
I already had the one condition from this answer (I don’t know why)
https://stackoverflow.com/a/27295145/1175496
That is, my PATH already included %APPDATA%npm
In my case, the problem was npm was not installing modules there (again, I don’t know why)
Therefore I needed to do this:
$ npm config set prefix -g %APPDATA%/npm
After that, running
$ npm install -g gulp
(or installing any other module) put the module in the place where PATH expects it.
This works for me:
npm link gulp
npm update
On my Windows 10 Enterprise, gulp was not installed in %AppData%, which is C:UsersusernameAppDatanpmnode_modules on my machine, but in C:UsersusernameAppDataLocalnpmnode_modules.
To get gulp to be picked up at the command prompt or in powershell, I added to the user PATH the value C:UsersusernameAppDataLocalnpm. After that it worked like a charm. Naturally I had to close the command prompt or powershell window and re-open for the above to take effect.
Had gulp command not found problem in windows 10 and Adding «%AppData%npmnode_modules» doesn’t work for me.
Do this steps please:
After doing
npm install -g npm
And
npm install -g gulp
Add
C:UsersYourUsernamenpm
to Path in System Variables.
It Works for me after all solutions failed me.
Run npm install gulp -g
if you are using windows, please add the gulp’s dir to PATH.
such like C:UsersYOURNAMEAppDataRoamingnpmnode_modulesgulp
In windows:
- Using your windows explorer, Navigate to your vagrant shared folder (I am using scotchbox by the way) e.g
C:scotchbox/public/gulpProject
- In the address bar of the folder, type
cmd
and press Enter - Do your gulp installation
npm install
In short:
You should add %NODE_PATH%
to the system variable Path
if the other answers don’t work.
The reason:
The point is, command prompt only executes programs under the Path
system variable, not the user variables. If you have NODE_PATH
set as a user variable, add %NODE_PATH%
to Path
.
I asked here and got marked duplicate for a question with different intention
NPM Windows doesn’t execute program under the User Variable path [duplicate]
In Windows:
- Press the following two keys: Windows + r
- Type
control /name microsoft.system
into the run dialog box that appears from the previous step.
- Select Advanced System Settings from the left of the window pane
- Click the Advanced tab on the system properties box that appears and click the Environment Variables button.
- Edit the
PATH
User environment variable. - Click New on the edit environment variable window that pops up for the
PATH
variable and add the following:%APPDATA%npm
to the start of thePATH
environment variable (as shown in the image below).
- Close your Command Prompt and reopen it.