简体   繁体   English

Yeoman / Gulp在Mac上引发“ spawn gulp ENOENT”错误

[英]Yeoman/Gulp throwing 'spawn gulp ENOENT' error on a Mac

Please note: I do see this question as well as this one but those were both instances where the developer was on Windows , and the solution was Windows-specific. 请注意: 看到这个问题 ,以及这一个 ,但这些都是实例,其中开发人员是在Windows和解决方案是针对Windows的。 I am on a Mac! 我在Mac上! Please don't closevote as a duplicate!!! 请不要关闭投票作为重复!!!


Mac 10.12.6 here. Mac 10.12.6在这里。 I'm new to AngularJS (v1.x) and am trying to follow this tutorial on using Yeoman to create an internationalized AngularJS app . 我是AngularJS(v1.x)的新手 ,正在尝试按照本教程使用Yeoman创建国际化的AngularJS应用程序

I install the Yeoman AngularJS generator and create a directory for my simple/test app: 我安装了Yeoman AngularJS生成器,并为我的简单/测试应用程序创建了一个目录:

npm install -g generator-angular
mkdir angular-translate-yeoman && cd $_

Then I go to create my internationalization AngularJS app: 然后我去创建我的国际化AngularJS应用程序:

yo angular translate

It asks me a bunch of questions, I select gulp instead of grunt , and then starts generating the scaffolding. 它问了我很多问题, 我选择了gulp而不是grunt ,然后开始生成脚手架。 About a minute later I get the following error: 大约一分钟后,出现以下错误:

events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: spawn gulp ENOENT
    at exports._errnoException (util.js:1020:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
    at onErrorNT (internal/child_process.js:367:16)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)

Anybody have any idea what the problem is and what the fix is? 任何人都知道问题是什么以及解决的方法是什么?

I'm leaving this question up rather than deleting it. 我把这个问题留了下来,而不是删除了。 The problem was that I didn't have gulp installed, and the tutorial I was using never bothered to mentioned installing gulp as a pre-requisite. 问题是我没有安装gulp,而我所使用的教程也没有提到要安装gulp作为先决条件。 Not knowing anything about Yeoman, I guess I figured it would install any JS dependencies for me. 不知道有关文书上士什么 ,我想我想通这将安装任何JS依赖我。

So this is the error you'll receive when you're on a Mac and using Yeoman + Gulp together, but Gulp isn't installed on your machine. 因此,这是在Mac上同时使用Yeoman + Gulp时会收到的错误,但您的计算机上未安装Gulp。 To install Gulp : 要安装Gulp

npm install gulp-cli -g
npm install gulp -D
touch gulpfile.js
gulp --help

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM