gulp命令未找到 - 安装gulp后出错 [英] gulp command not found - error after installing gulp

查看:1230
本文介绍了gulp命令未找到 - 安装gulp后出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在全球和本地安装了gulp

  npm install gulp 
npm install gulp -g
npm install gulp-util
npm install gulp-util -g

尝试运行吞噬我得到



'gulp'不被识别为内部或外部命令,可操作程序或批处理文件。



运行npm list gulp(或-g),I gulp@3.7.0 我的全球或本地gulp安装。



我试着运行指向我的gulpfile的 node gulpfile.js 它运行时没有错误,当然,它以 require('gulp')>开头。

有关在Windows(8.1)上使用gulp的建议?

解决方案

问题和答案可以在这个问题中找到: https://stackoverflow.com/a/9588052/1041104



npm模块(如gulp)未安装到路径。因此在CMD中运行它们时没有找到。



如果全球安装了gulp,则可以使用以下过程:


  1. 创建一个名为 NODE_PATH
  2. 的环境变量
  3. 将其设置为:%AppData%\\\
    pm\\\
    ode_modules
    %AppData%\ npm 在Windows 8-10上

  4. 关闭CMD并重新打开以获取新的ENV变量



运行 npm ls npm ls -g 显示它们已安装,但由于缺少链接,所以CMD找不到它们


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)?

解决方案

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:

  1. Create an environmental variable called NODE_PATH
  2. Set it to: %AppData%\npm\node_modules or %AppData%\npm on windows 8-10
  3. 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.

这篇关于gulp命令未找到 - 安装gulp后出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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