I've installed gulp both globally and locally using
我在全球和本地都安装了gulp
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.
“gulp”不能识别为内部或外部命令、可操作程序或批处理文件。
Running npm list gulp (or -g), I gulp@3.7.0
with the location of either my global or local gulp installation.
运行npm列表gulp(或-g),我gulp@3.7.0带有我的全局或本地gulp安装的位置。
I've tried running node gulpfile.js
pointed to my gulpfile, and it runs without error, and of course, it starts with require('gulp')
.
我尝试过运行node gulpfile。js指向我的gulpfile,它毫无错误地运行,当然,它以require(“gulp”)开头。
Any suggestions on getting gulp working on Windows(8.1)?
对Windows(8.1)有什么建议吗?
37 个解决方案
#1
183
The issue and answer can be found in this question: https://*.com/a/9588052/1041104
问题和答案可以在这个问题中找到:https://*.com/a/958802/1041104
The npm modules such as gulp are not installed to the path. Thus are not found when you run them in the CMD.
像gulp这样的npm模块没有安装到路径上。因此,在CMD中运行它们时不会找到它们。
If gulp has been installed globally, you can use the process below:
如果gulp已在全球安装,您可以使用以下流程:
- Create an environmental variable called
NODE_PATH
- 创建一个名为NODE_PATH的环境变量
- Set it to:
%AppData%\npm\node_modules
or%AppData%\npm
on windows 8-10 - 设置为:windows 8-10上%AppData%\npm\node_modules或%AppData%\npm
- Close CMD, and Re-Open to get the new ENV variables
- 关闭CMD,重新打开以获得新的ENV变量。
Running npm ls
and npm ls -g
shows that they are installed, but the CMD can not find them due to the missing link
.
运行npm ls和npm ls -g显示它们已经安装,但是由于缺少链接,CMD无法找到它们。
#2
155
You forgot to install the gulp-cli package:
您忘记安装gulp-cli包:
npm install -g gulp-cli
Then you can run the command "gulp" from the command line.
然后可以从命令行运行命令“gulp”。
#3
69
- Be sure that you have gulp and
gulp.cmd
(use windows search) - 一定要有吞咽和吞咽。cmd(使用windows搜索)
- Copy the path of
gulp.cmd
(C:\Users\XXXX\AppData\Roaming\npm
) - 复制gulp的路径。cmd(C:\ \ XXXX \ AppData \漫游用户\ npm)
- Add this path to the Path envirement variable or edit
PATH
environment variable and add%APPDATA%\npm
- 将此路径添加到path环境变量或编辑path环境变量,并添加%APPDATA%\npm。
- Reopen cmd.
- 重新打开cmd。
Add %APPDATA%\npm
to front of Path, not end of the Path.
将%APPDATA%\npm添加到路径前面,而不是路径的末端。
#4
36
-
Install gulp globally.
全球安装吞咽。
npm install -g gulp
npm安装- g吞咽
-
Install gulp locally in the project.
在项目中本地安装gulp。
npm install gulp
npm安装杯
-
Add below line in your package.json
在package.json中添加以下行
"scripts": { "gulp": "gulp" }
“剧本”:{“咽”:“咽”}
-
Run gulp.
运行吞咽。
npm run gulp
npm运行吞咽
This worked for me.
这为我工作。
#5
34
I am using Windows 8.1. I had the same problem.
我使用的是Windows 8.1。我也有同样的问题。
I installed gulp using Node.js command prompt
我使用Node安装了gulp。js命令提示符
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
如果您得到的是gulp本地版本,则没有发现当前节点的退出。命令提示符,并在新节点中尝试上述命令。js命令提示符
I tried the NODE_PATH mentioned by @SteveLacy but the command prompt was still not able to detect gulp command
我尝试了@SteveLacy提到的NODE_PATH,但是命令提示符仍然不能检测到gulp命令
#6
23
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
:
当然,最好还是包装好。json,因此您可以执行以下操作,在本地安装并向package.json中添加一个条目:
npm install --save-dev gulp
Everything else (gulp plugins) install also locally.
其他所有东西(吞咽插件)也安装在本地。
#7
15
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.
在我的环境变量中添加NODE_PATH并没有解决问题。
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.
如果您在系统变量中编辑“Path”变量,并在其末尾添加“%APPDATA%\npm”,那么它应该可以修复问题……除非您或其他人已经安装了gulp作为另一个用户,而不是您当前登录的用户。
If you want it to be available for all users, put 'C:\Users\yourUser\AppData\Roaming\npm'(or where ever you have gulp) explicitly instead of using '%APPDATA%\npm'. You can also move the files to a more user-indifferent path.
如果你想让所有的用户都可以使用它,那么可以使用“C:\用户\yourUser\AppData\ \npm”(或者你曾经有过的“gulp”),而不是使用“% AppData %\npm”。您还可以将文件移动到一个用户无关的路径。
Don't forget to start a new cmd prompt, because the one you have open won't get the new 'Path' variable automatically.
不要忘记启动一个新的cmd提示符,因为打开的那个不会自动获得新的“Path”变量。
Now 'gulp'.
现在“杯”。
#8
12
One right way:
一个正确的方法:
- Cmd + R : type "%appdata%"
- Cmd + R:输入“%appdata%”
- Go to npm folder
- 去npm文件夹
- Copy whole path like "C:\Users\Blah...\npm\"
- 复制整个路径,例如“C:\用户\Blah…\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:\Users\Blah...\npm\" to the end and type ";" after that
- 添加“C:\ \用户等等……\npm\" to the end and type ";" after that "
- Click ok and reopen cmd
- 单击ok并重新打开cmd。
#9
12
The simple solution just do npm link gulp
简单的解决方案就是做npm链接。
#10
9
You should first install gulp
as global using:
您应该首先安装gulp作为全球使用:
npm install gulp -g
Otherwise the path solution will not resolve the problem.
否则,路径解决方案将无法解决问题。
Then add the npm modules path to the PATH using:
然后将npm模块路径添加到路径中,使用:
PATH = %PATH%;%APPDATA%\npm
#11
8
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)
我在windows 10中也遇到过类似的问题。我的答案是特定于windows的(查看关于在bash中修改linux或OSX解决方案路径的答案)
The core problem I had was that npm's folder was not registered in the path. I originally tried changing this in cmd prompt.
我遇到的核心问题是npm的文件夹没有在路径中注册。我最初尝试在cmd提示符中修改这个。
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.
注意,我使用了setx而不是set来确保对环境变量的更新保持不变。还要注意,它是反斜杠。
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).
这应该行得通,但对我来说不行,因为setx只能接受1024个字符……(是的,对我来说也是荒谬的)。
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.
所以试试上面的方法,如果你得到一个类似于达到1024极限的警告,你可以用另一种方法。
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.
当您还在控制台时,输入:echo %appdata%\npm…这是您想要添加到路径中的npm文件夹,因此将它添加到剪贴板。
You have to go into the registry and reach the following folder:
你必须进入登记处,到达以下文件夹:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \会话管理器\ \控制环境
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.
然后将“Path”值附加到剪贴板中的npm文件夹路径。重新启动以激活新值,现在应该可以开始了。
Finally, just test it all out
最后,测试一下
>npm install -g gulp
>gulp
#12
7
Try to add to your PATH variable the following:
尝试向路径变量中添加以下内容:
C:\Users\YOUR_USER\AppData\Roaming\npm
I had the same problem and I solved adding the path to my node modules.
我遇到了同样的问题,我解决了向节点模块添加路径的问题。
#13
6
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.
我正在使用一个虚拟机,它有一个以前的所有者。前一个所有者安装了一个旧版本的npm。使用它,我在全球安装了gulp和npm安装-g gulp。运行命令gulp将返回'gulp'不被识别为内部或外部命令、可操作程序或批处理文件。正如我所说,上面的答案并不能解决我的问题。我需要重新安装nodejs。
Solution
解决方案
- Re-download nodejs
- 重新下载nodejs
npm install -g gulp
- npm安装- g吞咽
gulp -version
- 杯- version
This fixed the problem for me.
这就解决了我的问题。
#14
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.
这最终导致了我的“用户”问题。我已经在系统上安装了npm和node作为user1登录,然后我设置了user2。我可以运行node,可以运行npm commnds,但是不能从命令行运行任何npm包。
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.
我卸载了节点和npm,并在正确的用户下重新安装,以解决问题。之后,我就可以从命令行运行包了。
#15
4
I had v0.12.3 of Nodejs on Win7 x64 and ran into similar issues when I tried installing gulp. This worked for me:
我在Win7 x64上有Nodejs的v0.12.3版本,当我尝试安装gulp时也遇到了类似的问题。这工作对我来说:
- Uninstalled Nodejs
- 卸载Nodejs
- Installed Nodejs v0.10.29
- 安装Nodejs v0.10.29
- npm install -g npm
- npm安装- g npm
- npm install -g gulp
- npm安装- g吞咽
#16
4
The NodeJS installer appears to add the user/AppData/Roaming/npm path to the user environment path, which is appropriate.
NodeJS安装程序似乎将用户/AppData/漫游式/npm路径添加到用户环境路径中,这是适当的。
Normally, the PATH environment variable at the command line is the combination of the user environment path and the system environment path.
通常,命令行中的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.
但是,如果用户环境路径+系统环境路径大于1920个字符,则Windows不合并用户路径和系统路径——只使用系统环境路径。
See: https://*.com/a/21270921/301152
参见:https://*.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.
因此,当您打开Windows中的高级系统设置以编辑环境变量时,请查看用户/AppData/漫游者/npm路径是否已经在您的用户环境路径中。如果是,那么问题是您的用户+系统路径太长,导致Windows忽略您的用户路径。修剪你的用户和/或系统路径字符串和咽应该工作在安装。
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.
如果您找不到任何需要修改的用户和系统路径,那么将用户/应用程序数据/漫游/npm路径添加到系统环境路径中,并将其称为hack。
#17
#18
4
Add this path in your Environment Variables PATH C:\Users\USERNAME\AppData\Roaming\npm\
在你的环境变量path C:\Users\USERNAME\AppData\Roaming\npm\添加这条路径
#19
3
I already had the one condition from this answer (I don't know why)
我已经有了这个答案中的一个条件(我不知道为什么)
https://*.com/a/27295145/1175496
https://*.com/a/27295145/1175496
That is, my PATH already included %APPDATA%\npm
也就是说,我的路径已经包含了%APPDATA%\npm
In my case, the problem was npm was not installing modules there (again, I don't know why)
在我的例子中,问题是npm没有在那里安装模块(我也不知道为什么)
Therefore I needed to do this:
因此我需要这样做:
$ npm config set prefix -g %APPDATA%/npm
$ npm配置设置前缀-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.
之后,运行$ npm安装-g gulp(或安装任何其他模块)将模块放在PATH期望的位置。
#20
2
Had gulp command not found problem in windows 10 and Adding "%AppData%\npm\node_modules" doesn't work for me. Do this steps please:
在windows 10中没有发现gulp命令的问题,添加“%AppData%\npm\node_modules”对我来说行不通。请做这个步骤:
After doing
后做
npm install -g npm
npm安装- g npm
And
和
npm install -g gulp
npm安装- g吞咽
Add
添加
C:\Users\YourUsername\npm
C:\Users\ YourUsername \ npm
to Path in System Variables.
到系统变量中的路径。
It Works for me after all solutions failed me.
在所有的解决方案都让我失望之后,它对我很有效。
#21
2
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.
这会告诉你路径环境变量是什么。如果没有node_modules,请执行以下操作,从APPDATA路径添加它。
PATH = %PATH%; %APPDATA%\npm
路径= %路径%;% APPDATA % \ npm
#22
2
I resolved it by adding C:\Users\[USER]\AppData\Roaming\npm
to PATH
and not C:\Users\[USER]\AppData\Roaming\npm\node_modules
我解决它通过添加C:\Users\[用户]\ AppData \ \ npm漫游路径而不是C:\Users\[用户]\ AppData \ \ npm \ node_modules徘徊
#23
2
Run npm install gulp -g
运行npm安装gulp -g
if you are using windows, please add the gulp's dir to PATH.
如果您正在使用windows,请将gulp的dir添加到PATH中。
such like C:\Users\YOURNAME\AppData\Roaming\npm\node_modules\gulp
类似C:\Users\YOURNAME\AppData\Roaming\npm\ node_modules \吞咽
#24
2
This works for me:
这工作对我来说:
npm link gulp
npm update
#25
1
If you're on Windows and gulp is not recognized as an internal or external command, operable program or batch file try running gulp.js instead.
如果您在Windows上,并且gulp不被识别为内部或外部命令、可操作程序或批处理文件,请尝试运行gulp。js。
I'm working on a laravel project, and running gulp locally. Also use something other then Windows command prompt, because you will probably get an error with gulp.js. I am using Git bash, and it works perfectly.
我正在做一个laravel项目,并在本地运行gulp。还要使用Windows命令提示符,因为您可能会在gulp.js中得到一个错误。我使用的是Git bash,它运行得很好。
#26
1
Navigate to where you installed node modules in cmd up to .bin folder, then run gulp. I.e. path\node_modules.bin>>gulp
This worked for me excellently. My path was C:\wamp\www\wyntonv2\node_modules.bin
导航到在cmd中安装节点模块的位置,直到.bin文件夹,然后运行gulp。即路径\ node_modules。这对我很有效。我的路径是C:\ wamp \ www \ wyntonv2 \ node_modules.bin
#27
1
If you need to install a global version gulp as described on the gulpjs.com site and still have issues, you may need to clean npm's cache. For instance, if you have previously installed gulp and managed to blow it away by accident, it may not install properly again because it's looking for directories that no longer exist. In which case, run:
如果您需要按照gulps.com站点上的描述安装一个全局版本gulp,并且仍然存在问题,您可能需要清理npm的缓存。例如,如果您以前安装了gulp并设法将其吹散,那么它可能不会重新安装,因为它正在查找不再存在的目录。在这种情况下,运行:
sudo npm cache clean
sudo npm缓存清理
Then install gulp as you normally would.
然后像往常一样喝一口。
#28
1
In windows:
在windows中:
- Using your windows explorer, Navigate to your vagrant shared folder (I am using scotchbox by the way) e.g
C:\scotchbox/public/gulpProject
- 使用您的windows资源管理器,导航到您的流浪共享文件夹(顺便说一下,我正在使用scotchbox) e。g C:\ scotchbox /公共/ gulpProject
- In the address bar of the folder, type
cmd
and press Enter - 在文件夹的地址栏中,键入cmd并按Enter键
- Do your gulp installation
npm install
- 你的gulp安装npm安装吗
#29
1
In my case, none of the approaches listed worked. I finally downloaded Rapid Environment Editor (ver 8).
在我的例子中,列出的所有方法都不起作用。我终于下载了快速环境编辑器(ver8)。
It showed that my additions to the user environment variables weren't present. When I added them with REE, everything worked immediately.
它显示我对用户环境变量的添加没有出现。当我把它们和REE加在一起的时候,一切都立即开始了。
(Running Windows 8.1)
(运行Windows 8.1)
#30
1
In short:
You should add %NODE_PATH%
to the system variable Path
if the other answers don't work.
如果其他答案不起作用,您应该向系统变量路径添加%NODE_PATH%。
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
.
要点是,命令提示符只执行路径系统变量下的程序,而不是用户变量。如果将NODE_PATH设置为用户变量,则将%NODE_PATH%添加到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]
NPM窗口不执行用户变量路径下的程序[复制]
#1
183
The issue and answer can be found in this question: https://*.com/a/9588052/1041104
问题和答案可以在这个问题中找到:https://*.com/a/958802/1041104
The npm modules such as gulp are not installed to the path. Thus are not found when you run them in the CMD.
像gulp这样的npm模块没有安装到路径上。因此,在CMD中运行它们时不会找到它们。
If gulp has been installed globally, you can use the process below:
如果gulp已在全球安装,您可以使用以下流程:
- Create an environmental variable called
NODE_PATH
- 创建一个名为NODE_PATH的环境变量
- Set it to:
%AppData%\npm\node_modules
or%AppData%\npm
on windows 8-10 - 设置为:windows 8-10上%AppData%\npm\node_modules或%AppData%\npm
- Close CMD, and Re-Open to get the new ENV variables
- 关闭CMD,重新打开以获得新的ENV变量。
Running npm ls
and npm ls -g
shows that they are installed, but the CMD can not find them due to the missing link
.
运行npm ls和npm ls -g显示它们已经安装,但是由于缺少链接,CMD无法找到它们。
#2
155
You forgot to install the gulp-cli package:
您忘记安装gulp-cli包:
npm install -g gulp-cli
Then you can run the command "gulp" from the command line.
然后可以从命令行运行命令“gulp”。
#3
69
- Be sure that you have gulp and
gulp.cmd
(use windows search) - 一定要有吞咽和吞咽。cmd(使用windows搜索)
- Copy the path of
gulp.cmd
(C:\Users\XXXX\AppData\Roaming\npm
) - 复制gulp的路径。cmd(C:\ \ XXXX \ AppData \漫游用户\ npm)
- Add this path to the Path envirement variable or edit
PATH
environment variable and add%APPDATA%\npm
- 将此路径添加到path环境变量或编辑path环境变量,并添加%APPDATA%\npm。
- Reopen cmd.
- 重新打开cmd。
Add %APPDATA%\npm
to front of Path, not end of the Path.
将%APPDATA%\npm添加到路径前面,而不是路径的末端。
#4
36
-
Install gulp globally.
全球安装吞咽。
npm install -g gulp
npm安装- g吞咽
-
Install gulp locally in the project.
在项目中本地安装gulp。
npm install gulp
npm安装杯
-
Add below line in your package.json
在package.json中添加以下行
"scripts": { "gulp": "gulp" }
“剧本”:{“咽”:“咽”}
-
Run gulp.
运行吞咽。
npm run gulp
npm运行吞咽
This worked for me.
这为我工作。
#5
34
I am using Windows 8.1. I had the same problem.
我使用的是Windows 8.1。我也有同样的问题。
I installed gulp using Node.js command prompt
我使用Node安装了gulp。js命令提示符
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
如果您得到的是gulp本地版本,则没有发现当前节点的退出。命令提示符,并在新节点中尝试上述命令。js命令提示符
I tried the NODE_PATH mentioned by @SteveLacy but the command prompt was still not able to detect gulp command
我尝试了@SteveLacy提到的NODE_PATH,但是命令提示符仍然不能检测到gulp命令
#6
23
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
:
当然,最好还是包装好。json,因此您可以执行以下操作,在本地安装并向package.json中添加一个条目:
npm install --save-dev gulp
Everything else (gulp plugins) install also locally.
其他所有东西(吞咽插件)也安装在本地。
#7
15
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.
在我的环境变量中添加NODE_PATH并没有解决问题。
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.
如果您在系统变量中编辑“Path”变量,并在其末尾添加“%APPDATA%\npm”,那么它应该可以修复问题……除非您或其他人已经安装了gulp作为另一个用户,而不是您当前登录的用户。
If you want it to be available for all users, put 'C:\Users\yourUser\AppData\Roaming\npm'(or where ever you have gulp) explicitly instead of using '%APPDATA%\npm'. You can also move the files to a more user-indifferent path.
如果你想让所有的用户都可以使用它,那么可以使用“C:\用户\yourUser\AppData\ \npm”(或者你曾经有过的“gulp”),而不是使用“% AppData %\npm”。您还可以将文件移动到一个用户无关的路径。
Don't forget to start a new cmd prompt, because the one you have open won't get the new 'Path' variable automatically.
不要忘记启动一个新的cmd提示符,因为打开的那个不会自动获得新的“Path”变量。
Now 'gulp'.
现在“杯”。
#8
12
One right way:
一个正确的方法:
- Cmd + R : type "%appdata%"
- Cmd + R:输入“%appdata%”
- Go to npm folder
- 去npm文件夹
- Copy whole path like "C:\Users\Blah...\npm\"
- 复制整个路径,例如“C:\用户\Blah…\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:\Users\Blah...\npm\" to the end and type ";" after that
- 添加“C:\ \用户等等……\npm\" to the end and type ";" after that "
- Click ok and reopen cmd
- 单击ok并重新打开cmd。
#9
12
The simple solution just do npm link gulp
简单的解决方案就是做npm链接。
#10
9
You should first install gulp
as global using:
您应该首先安装gulp作为全球使用:
npm install gulp -g
Otherwise the path solution will not resolve the problem.
否则,路径解决方案将无法解决问题。
Then add the npm modules path to the PATH using:
然后将npm模块路径添加到路径中,使用:
PATH = %PATH%;%APPDATA%\npm
#11
8
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)
我在windows 10中也遇到过类似的问题。我的答案是特定于windows的(查看关于在bash中修改linux或OSX解决方案路径的答案)
The core problem I had was that npm's folder was not registered in the path. I originally tried changing this in cmd prompt.
我遇到的核心问题是npm的文件夹没有在路径中注册。我最初尝试在cmd提示符中修改这个。
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.
注意,我使用了setx而不是set来确保对环境变量的更新保持不变。还要注意,它是反斜杠。
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).
这应该行得通,但对我来说不行,因为setx只能接受1024个字符……(是的,对我来说也是荒谬的)。
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.
所以试试上面的方法,如果你得到一个类似于达到1024极限的警告,你可以用另一种方法。
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.
当您还在控制台时,输入:echo %appdata%\npm…这是您想要添加到路径中的npm文件夹,因此将它添加到剪贴板。
You have to go into the registry and reach the following folder:
你必须进入登记处,到达以下文件夹:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \会话管理器\ \控制环境
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.
然后将“Path”值附加到剪贴板中的npm文件夹路径。重新启动以激活新值,现在应该可以开始了。
Finally, just test it all out
最后,测试一下
>npm install -g gulp
>gulp
#12
7
Try to add to your PATH variable the following:
尝试向路径变量中添加以下内容:
C:\Users\YOUR_USER\AppData\Roaming\npm
I had the same problem and I solved adding the path to my node modules.
我遇到了同样的问题,我解决了向节点模块添加路径的问题。
#13
6
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.
我正在使用一个虚拟机,它有一个以前的所有者。前一个所有者安装了一个旧版本的npm。使用它,我在全球安装了gulp和npm安装-g gulp。运行命令gulp将返回'gulp'不被识别为内部或外部命令、可操作程序或批处理文件。正如我所说,上面的答案并不能解决我的问题。我需要重新安装nodejs。
Solution
解决方案
- Re-download nodejs
- 重新下载nodejs
npm install -g gulp
- npm安装- g吞咽
gulp -version
- 杯- version
This fixed the problem for me.
这就解决了我的问题。
#14
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.
这最终导致了我的“用户”问题。我已经在系统上安装了npm和node作为user1登录,然后我设置了user2。我可以运行node,可以运行npm commnds,但是不能从命令行运行任何npm包。
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.
我卸载了节点和npm,并在正确的用户下重新安装,以解决问题。之后,我就可以从命令行运行包了。
#15
4
I had v0.12.3 of Nodejs on Win7 x64 and ran into similar issues when I tried installing gulp. This worked for me:
我在Win7 x64上有Nodejs的v0.12.3版本,当我尝试安装gulp时也遇到了类似的问题。这工作对我来说:
- Uninstalled Nodejs
- 卸载Nodejs
- Installed Nodejs v0.10.29
- 安装Nodejs v0.10.29
- npm install -g npm
- npm安装- g npm
- npm install -g gulp
- npm安装- g吞咽
#16
4
The NodeJS installer appears to add the user/AppData/Roaming/npm path to the user environment path, which is appropriate.
NodeJS安装程序似乎将用户/AppData/漫游式/npm路径添加到用户环境路径中,这是适当的。
Normally, the PATH environment variable at the command line is the combination of the user environment path and the system environment path.
通常,命令行中的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.
但是,如果用户环境路径+系统环境路径大于1920个字符,则Windows不合并用户路径和系统路径——只使用系统环境路径。
See: https://*.com/a/21270921/301152
参见:https://*.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.
因此,当您打开Windows中的高级系统设置以编辑环境变量时,请查看用户/AppData/漫游者/npm路径是否已经在您的用户环境路径中。如果是,那么问题是您的用户+系统路径太长,导致Windows忽略您的用户路径。修剪你的用户和/或系统路径字符串和咽应该工作在安装。
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.
如果您找不到任何需要修改的用户和系统路径,那么将用户/应用程序数据/漫游/npm路径添加到系统环境路径中,并将其称为hack。
#17
4
I was facing the same problem after installation. So i tried running cmd
with elevated privileges (admin) and it worked.
安装后我也遇到了同样的问题。因此,我尝试使用高级特权(admin)运行cmd,它成功了。
Screen capture:
屏幕截图:
#18
4
Add this path in your Environment Variables PATH C:\Users\USERNAME\AppData\Roaming\npm\
在你的环境变量path C:\Users\USERNAME\AppData\Roaming\npm\添加这条路径
#19
3
I already had the one condition from this answer (I don't know why)
我已经有了这个答案中的一个条件(我不知道为什么)
https://*.com/a/27295145/1175496
https://*.com/a/27295145/1175496
That is, my PATH already included %APPDATA%\npm
也就是说,我的路径已经包含了%APPDATA%\npm
In my case, the problem was npm was not installing modules there (again, I don't know why)
在我的例子中,问题是npm没有在那里安装模块(我也不知道为什么)
Therefore I needed to do this:
因此我需要这样做:
$ npm config set prefix -g %APPDATA%/npm
$ npm配置设置前缀-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.
之后,运行$ npm安装-g gulp(或安装任何其他模块)将模块放在PATH期望的位置。
#20
2
Had gulp command not found problem in windows 10 and Adding "%AppData%\npm\node_modules" doesn't work for me. Do this steps please:
在windows 10中没有发现gulp命令的问题,添加“%AppData%\npm\node_modules”对我来说行不通。请做这个步骤:
After doing
后做
npm install -g npm
npm安装- g npm
And
和
npm install -g gulp
npm安装- g吞咽
Add
添加
C:\Users\YourUsername\npm
C:\Users\ YourUsername \ npm
to Path in System Variables.
到系统变量中的路径。
It Works for me after all solutions failed me.
在所有的解决方案都让我失望之后,它对我很有效。
#21
2
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.
这会告诉你路径环境变量是什么。如果没有node_modules,请执行以下操作,从APPDATA路径添加它。
PATH = %PATH%; %APPDATA%\npm
路径= %路径%;% APPDATA % \ npm
#22
2
I resolved it by adding C:\Users\[USER]\AppData\Roaming\npm
to PATH
and not C:\Users\[USER]\AppData\Roaming\npm\node_modules
我解决它通过添加C:\Users\[用户]\ AppData \ \ npm漫游路径而不是C:\Users\[用户]\ AppData \ \ npm \ node_modules徘徊
#23
2
Run npm install gulp -g
运行npm安装gulp -g
if you are using windows, please add the gulp's dir to PATH.
如果您正在使用windows,请将gulp的dir添加到PATH中。
such like C:\Users\YOURNAME\AppData\Roaming\npm\node_modules\gulp
类似C:\Users\YOURNAME\AppData\Roaming\npm\ node_modules \吞咽
#24
2
This works for me:
这工作对我来说:
npm link gulp
npm update
#25
1
If you're on Windows and gulp is not recognized as an internal or external command, operable program or batch file try running gulp.js instead.
如果您在Windows上,并且gulp不被识别为内部或外部命令、可操作程序或批处理文件,请尝试运行gulp。js。
I'm working on a laravel project, and running gulp locally. Also use something other then Windows command prompt, because you will probably get an error with gulp.js. I am using Git bash, and it works perfectly.
我正在做一个laravel项目,并在本地运行gulp。还要使用Windows命令提示符,因为您可能会在gulp.js中得到一个错误。我使用的是Git bash,它运行得很好。
#26
1
Navigate to where you installed node modules in cmd up to .bin folder, then run gulp. I.e. path\node_modules.bin>>gulp
This worked for me excellently. My path was C:\wamp\www\wyntonv2\node_modules.bin
导航到在cmd中安装节点模块的位置,直到.bin文件夹,然后运行gulp。即路径\ node_modules。这对我很有效。我的路径是C:\ wamp \ www \ wyntonv2 \ node_modules.bin
#27
1
If you need to install a global version gulp as described on the gulpjs.com site and still have issues, you may need to clean npm's cache. For instance, if you have previously installed gulp and managed to blow it away by accident, it may not install properly again because it's looking for directories that no longer exist. In which case, run:
如果您需要按照gulps.com站点上的描述安装一个全局版本gulp,并且仍然存在问题,您可能需要清理npm的缓存。例如,如果您以前安装了gulp并设法将其吹散,那么它可能不会重新安装,因为它正在查找不再存在的目录。在这种情况下,运行:
sudo npm cache clean
sudo npm缓存清理
Then install gulp as you normally would.
然后像往常一样喝一口。
#28
1
In windows:
在windows中:
- Using your windows explorer, Navigate to your vagrant shared folder (I am using scotchbox by the way) e.g
C:\scotchbox/public/gulpProject
- 使用您的windows资源管理器,导航到您的流浪共享文件夹(顺便说一下,我正在使用scotchbox) e。g C:\ scotchbox /公共/ gulpProject
- In the address bar of the folder, type
cmd
and press Enter - 在文件夹的地址栏中,键入cmd并按Enter键
- Do your gulp installation
npm install
- 你的gulp安装npm安装吗
#29
1
In my case, none of the approaches listed worked. I finally downloaded Rapid Environment Editor (ver 8).
在我的例子中,列出的所有方法都不起作用。我终于下载了快速环境编辑器(ver8)。
It showed that my additions to the user environment variables weren't present. When I added them with REE, everything worked immediately.
它显示我对用户环境变量的添加没有出现。当我把它们和REE加在一起的时候,一切都立即开始了。
(Running Windows 8.1)
(运行Windows 8.1)
#30
1
In short:
You should add %NODE_PATH%
to the system variable Path
if the other answers don't work.
如果其他答案不起作用,您应该向系统变量路径添加%NODE_PATH%。
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
.
要点是,命令提示符只执行路径系统变量下的程序,而不是用户变量。如果将NODE_PATH设置为用户变量,则将%NODE_PATH%添加到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]
NPM窗口不执行用户变量路径下的程序[复制]