角Fullstack需要外部模块通天寄存器 [英] Angular-Fullstack Requiring external module babel-register

查看:240
本文介绍了角Fullstack需要外部模块通天寄存器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到这个错误,当使用一饮而尽从角fullstack工程生成服务。拜托,我怎么能解决这个问题呢?该dependencie在设置的package.json 正常。

  [18时03分54秒]需要外部模块通天寄存器
/home/gcfabri/Workspace/sportfitness/gulpfile.babel.js:4
从lodash'导入_;
^^^^^^语法错误:意外的令牌进口
    在exports.runInThisContext(vm.js:53:16)
    在Module._compile(module.js:387:25)
    在装载机(/home/gcfabri/node_modules/babel-register/lib/node.js:134:5)
    在Object.require.extensions(匿名函数)作为.js文件(/home/gcfabri/node_modules/babel-register/lib/node.js:144:7)
    在Module.load(module.js:357:32)
    在Function.Module._load(module.js:314:12)
    在Module.require(module.js:367:17)
    在要求(内部/ module.js:16:19)
    在Liftoff.handleArguments(/home/gcfabri/.npm-global/lib/node_modules/gulp/bin/gulp.js:116:3)
    在起飞<&匿名GT; (/home/gcfabri/.npm-global/lib/node_modules/gulp/node_modules/liftoff/index.js:192:16)


解决方案

这听起来像你需要运行 NPM安装--save巴贝尔,需要。你可以阅读更多关于它这里

编辑:只是为了解释好一点,的目的通天-要求是编译所需的软件包在飞行巴贝尔。在这种情况下,我假设它的意思是编译ES6 JavaScript语法回到ES5的语法,因为它的失败在较新的ES6 导入语法。

我不知道通天如何在管道一饮而尽那里结束了,但它明确地被要求由东西 /home/gcfabri/Workspace/sportfitness/gulpfile.babel.js 。我不建议删除它,只是让你有发生的事情的想法。

我希望那个安装帮助扶养

I am getting this error when use gulp serve from a angular-fullstack project generator. Please, how can I solve this issue? The dependencie was set in package.json properly.

[18:03:54] Requiring external module babel-register
/home/gcfabri/Workspace/sportfitness/gulpfile.babel.js:4
import _ from 'lodash';
^^^^^^

SyntaxError: Unexpected token import
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at loader (/home/gcfabri/node_modules/babel-register/lib/node.js:134:5)
    at Object.require.extensions.(anonymous function) [as .js] (/home/gcfabri/node_modules/babel-register/lib/node.js:144:7)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Liftoff.handleArguments (/home/gcfabri/.npm-global/lib/node_modules/gulp/bin/gulp.js:116:3)
    at Liftoff.<anonymous> (/home/gcfabri/.npm-global/lib/node_modules/gulp/node_modules/liftoff/index.js:192:16)

It sounds like you need to run npm install --save babel-require. You can read more about it here.

Edit: Just to explain a bit better, the purpose of babel-require is to compile required packages with babel on the fly. In this case I'm assuming it's meant to be compiling ES6 javascript syntax back to ES5 syntax, because it's failing on the newer ES6 import syntax.

I'm not sure how babel ended up in your gulp pipeline there, but it's explicitly being required by something in /home/gcfabri/Workspace/sportfitness/gulpfile.babel.js. I wouldn't recommend removing it, but just so you have an idea of what's happening.

I hope installing that dependancy helps.

这篇关于角Fullstack需要外部模块通天寄存器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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