在Foundations中运行“ npm start”和“ npm install gulp”时出错

时间:2018-12-26 15:28:58

标签: gulp npm-install zurb-foundation-6 npm-start

我是电子邮件基金会的新手,我只是按照步骤逐步尝试安装所有组件。我已经安装了Git和Node.js(最新版本11.5.0)。

我创建了项目目录(test123),并在其中运行“ npm start”。我这样做并得到以下错误:

Alexandrus-MacBook-Pro-2:test123 alexcrisan$ npm start

> foundation-emails-template@1.0.0 start. /Users/alexcrisan/Documents/sites/test123
> gulp

[09:27:55] Failed to load external module @babel/register
[09:27:55] Failed to load external module babel-register
[09:27:55] Failed to load external module babel-core/register
[09:27:55] Failed to load external module babel/register
[09:27:55] Local gulp not found in ~/Documents/sites/test123
[09:27:55] Try running: npm install gulp
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! foundation-emails-template@1.0.0 start: `gulp`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the foundation-emails-template@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/alexcrisan/.npm/_logs/2018-12-26T14_27_55_973Z-debug.log

我按照错误代码安装gulp,并得到以下消息:

Alexandrus-MacBook-Pro-2:test123 alexcrisan$ npm install gulp
npm ERR! code 1
npm ERR! Command failed: /usr/bin/git checkout 4.0
npm ERR! error: pathspec '4.0' did not match any file(s) known to git.
npm ERR! 

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/alexcrisan/.npm/_logs/2018-12-26T15_03_01_008Z-debug.log

我在网上找到了一些类似的答案,但是没有找到一个直接的方法来解决这个问题,而不会使自己陷入更多的困惑。

运行Mac OS Mojave(最新)。

谢谢!

1 个答案:

答案 0 :(得分:0)

gulp的git发行版名称已从4.0更改为v4.0.0,这意味着git无法找到要安装的节点模块。

如果打开package.json,应该看到类似以下内容的

"gulp": "github:gulpjs/gulp#4.0",

替换为:

"gulp": "github:gulpjs/gulp#v4.0.0",

然后删除您的node-modules文件夹并重新安装,它现在应该可以正常运行。

我知道你的感受,这让我感到困惑了一段时间。为了解决该问题,我查看了github(https://github.com/gulpjs/gulp/releases)上的已发布版本,并使用v4.0.0版本代替了那里的版本。