gulp服务发生错误:需要外部模块babel-register

前端之家收集整理的这篇文章主要介绍了gulp服务发生错误:需要外部模块babel-register前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
运行yeoman生成器“Webapp”,运行gulp服务时我收到错误.以下是更好的背景版本:
sw_vers && node -e 'console.log(process.platform,process.versions)'
ProductName:    Mac OS X
ProductVersion: 10.11.3
BuildVersion:   15D21
darwin { http_parser: '2.6.0',node: '5.2.0',v8: '4.6.85.31',uv: '1.7.5',zlib: '1.2.8',ares: '1.10.1-DEV',icu: '56.1',modules: '47',openssl: '1.0.2e' }

node -v
v5.2.0

gulp -v
Requiring external module babel-register
CLI version 3.9.1
Local version 3.9.1

最后gulp服务错误

gulp serve
Requiring external module babel-register
\node_modules/babel-core/lib/transformation/file/options/option-manager.js:372
      throw new Error("Couldn't find preset " + JSON.stringify(val) + "      relative to directory " + JSON.stringify(dirname));

有人有什么想法可能是什么问题,有什么建议吗?

这是我试过的:

npm uninstall gulp 
npm install gulp 
//with global flag and not
npm install --save-dev gulp 
//installing babel-register manually w/wo global flag and --save-dev
npm install babel-register
npm cache clean

还读了几个其他帖子,类似的问题没有成功,下面的一些:

gulp serve: Failed to load external module babel-core/register

Requiring external module babel/register #726

babel was renamed to babel-core #727

Angular-Fullstack Requiring external module babel-register

解决方法

是的,运行npm安装后–global gulp-cli我运行gulp -v,我已经
Failed to load external module babel-register
Requiring external module babel-core/register
CLI version 1.2.1
Local version 3.9.1

然后我将CLI版本更新为3.9.1(与本地相同),但没有帮助.
但是当我将CLI版本降级到3.9.0时,它开始工作正常,并且不再显示消息“无法加载外部模块babel-register”.
看起来像3.9.1是错车.
跑:

npm install -g gulp@3.9.0

希望它会帮助你.

猜你在找的JavaScript相关文章