'gulp'不被识别为内部或外部命令 [英] 'gulp' is not recognized as an internal or external command

查看:667
本文介绍了'gulp'不被识别为内部或外部命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Gulp Node.Js ,以流式处理我的最小化和级联CSS/JS文件以进行生产的过程.

I am trying to use Gulp and Node.Js to stream my process for minifying and concatenating CSS/JS files for production.

这就是我所做的.

  1. 我在Windows 7计算机上安装了 Node.Js .
  2. 使用此命令npm install -g gulp
  3. 在全球范围内安装Gulp
  4. 然后我添加了一个名为NODE_PATH的新用户变量,将其设置为%AppData%\npm\node_modules
  1. I installed Node.Js on my Windows 7 machine.
  2. Installed Gulp globally using this command npm install -g gulp
  3. Then I added a new User variable called NODE_PATH set it to %AppData%\npm\node_modules

关闭并重新打开命令行后,我尝试从命令行(即gulp css)运行gulp任务.但这给了我以下错误

After closing and re-opening my command line, I tried to run a gulp task from the command line (i.e. gulp css). But that give me the following error

'gulp' is not recognized as an internal or external command

如何使它正常工作?

当我使用Windows中的搜索栏打开以下路径时, %AppData%\npm\node_modules我看到以下两个文件夹

When I opened the following path using the search bar in windows, %AppData%\npm\node_modules I see the following two folders

gulp
gulp-cli

我尝试将%AppData%\npm\node_modules添加到系统变量的Path变量中,但是并没有采用它,因为该变量达到了其允许的最大字符数限制.

I've tried to add %AppData%\npm\node_modules to the Path variable on my system variable, but it did not take it because that variable reached it's max allowed character limit.

我从Path变量中删除了几条路径,并添加了;C:\Users\[MyWindowsUserName]\AppData\Roaming\npm\node_modules

I removed couple of paths from my Path variable and added ;C:\Users\[MyWindowsUserName]\AppData\Roaming\npm\node_modules

但仍然无法正常工作.

我什至尝试使用此命令在运行时设置路径

I even tried to set the path at run time using this command

PATH=%PATH%;C:\Users\[MyWindowsUserName]\AppData\Roaming\npm\node_modules 然后运行gulp,仍然是同样的问题.

PATH=%PATH%;C:\Users\[MyWindowsUserName]\AppData\Roaming\npm\node_modules then run gulp and still the same issues.

我在这里想念什么?我还需要什么才能使它正常工作?

What am I missing here? What else do I need in order to get this to work?

推荐答案

我通过卸载NodeJs和gulp然后重新安装两者来解决了这个问题.

I solved the problem by uninstalling NodeJs and gulp then re-installing both again.

要全局安装gulp,我执行了以下命令

To install gulp globally I executed the following command

npm install -g gulp

这篇关于'gulp'不被识别为内部或外部命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆