首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >流星启动不了。ejson.js中的“在严格模式之外尚不支持块范围的声明(let、const、function、class)”

流星启动不了。ejson.js中的“在严格模式之外尚不支持块范围的声明(let、const、function、class)”
EN

Stack Overflow用户
提问于 2017-10-21 03:50:39
回答 1查看 566关注 0票数 0

我是Meteor的新手,只想安装和运行一个新的应用程序。上周五我的工作正常,但今天不得不重新安装,不能再运行应用程序了。

安装一直是一个挑战。尝试在Windows上安装,但发现安装程序不起作用。已求助于提取tar.gz文件。此外,由于公司限制,必须将其安装到备用位置( %LocalAppData%中的默认值由策略锁定)。但是,正如我所说的,这在上周是有效的,但今天无法使其正常工作。团队中的其他人也在本周开始看到这一点。当第一次运行meteor时,它会更新到meteor-tool到1.5.2.2,然后更新各种包。ejson包就是其中之一,并被更新到1.0.14。如果我运行meteor update,它会告诉我项目已经是1.5.2.2了。(最新)和顶级依赖项的最新兼容版本。我该如何解决这个问题?谢谢!

控制台输出:

代码语言:javascript
复制
C:\dev\R&D\meteor\meteor-test>meteor
[[[[[ C:\dev\R&D\meteor\meteor-test ]]]]]

=> Started proxy.
=> Started MongoDB.
W20171020-14:19:35.920(-5)? (STDERR) C:\dev\R&D\meteor\meteor-test\.meteor\local\build\programs\server\packages\ejson.js:749
W20171020-14:19:36.013(-5)? (STDERR)       for (let i = 0; i < length; i += 1) {
W20171020-14:19:36.016(-5)? (STDERR)            ^^^
W20171020-14:19:36.018(-5)? (STDERR)
W20171020-14:19:36.019(-5)? (STDERR) SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
W20171020-14:19:36.021(-5)? (STDERR)     at Object.exports.runInThisContext (vm.js:53:16)
W20171020-14:19:36.022(-5)? (STDERR)     at C:\dev\R&D\meteor\meteor-test\.meteor\local\build\programs\server\boot.js:332:30
W20171020-14:19:36.023(-5)? (STDERR)     at Array.forEach (native)
W20171020-14:19:36.025(-5)? (STDERR)     at Function._.each._.forEach (C:\dev\programs\.meteor\packages\meteor-tool\1.5.2_2\mt-os.windows.x86_32\dev_b
undle\server-lib\node_modules\underscore\underscore.js:79:11)
W20171020-14:19:36.026(-5)? (STDERR)     at C:\dev\R&D\meteor\meteor-test\.meteor\local\build\programs\server\boot.js:158:5
W20171020-14:19:36.028(-5)? (STDERR)     at C:\dev\R&D\meteor\meteor-test\.meteor\local\build\programs\server\boot.js:388:5
W20171020-14:19:36.029(-5)? (STDERR)     at Function.run (C:\dev\R&D\meteor\meteor-test\.meteor\local\build\programs\server\profile.js:510:12)
W20171020-14:19:36.031(-5)? (STDERR)     at C:\dev\R&D\meteor\meteor-test\.meteor\local\build\programs\server\boot.js:387:11
=> Exited with code: 1
W20171020-14:19:40.739(-5)? (STDERR) C:\dev\R&D\meteor\meteor-test\.meteor\local\build\programs\server\packages\ejson.js:749
W20171020-14:19:40.741(-5)? (STDERR)       for (let i = 0; i < length; i += 1) {
W20171020-14:19:40.745(-5)? (STDERR)            ^^^
W20171020-14:19:40.752(-5)? (STDERR)
W20171020-14:19:40.754(-5)? (STDERR) SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
W20171020-14:19:40.756(-5)? (STDERR)     at Object.exports.runInThisContext (vm.js:53:16)
W20171020-14:19:40.757(-5)? (STDERR)     at C:\dev\R&D\meteor\meteor-test\.meteor\local\build\programs\server\boot.js:332:30
W20171020-14:19:40.759(-5)? (STDERR)     at Array.forEach (native)
W20171020-14:19:40.762(-5)? (STDERR)     at Function._.each._.forEach (C:\dev\programs\.meteor\packages\meteor-tool\1.5.2_2\mt-os.windows.x86_32\dev_b
undle\server-lib\node_modules\underscore\underscore.js:79:11)
W20171020-14:19:40.765(-5)? (STDERR)     at C:\dev\R&D\meteor\meteor-test\.meteor\local\build\programs\server\boot.js:158:5
W20171020-14:19:40.767(-5)? (STDERR)     at C:\dev\R&D\meteor\meteor-test\.meteor\local\build\programs\server\boot.js:388:5
W20171020-14:19:40.769(-5)? (STDERR)     at Function.run (C:\dev\R&D\meteor\meteor-test\.meteor\local\build\programs\server\profile.js:510:12)
W20171020-14:19:40.771(-5)? (STDERR)     at C:\dev\R&D\meteor\meteor-test\.meteor\local\build\programs\server\boot.js:387:11
=> Exited with code: 1
W20171020-14:19:45.026(-5)? (STDERR) C:\dev\R&D\meteor\meteor-test\.meteor\local\build\programs\server\packages\ejson.js:749
W20171020-14:19:45.028(-5)? (STDERR)       for (let i = 0; i < length; i += 1) {
W20171020-14:19:45.030(-5)? (STDERR)            ^^^
W20171020-14:19:45.031(-5)? (STDERR)
W20171020-14:19:45.033(-5)? (STDERR) SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
W20171020-14:19:45.034(-5)? (STDERR)     at Object.exports.runInThisContext (vm.js:53:16)
W20171020-14:19:45.036(-5)? (STDERR)     at C:\dev\R&D\meteor\meteor-test\.meteor\local\build\programs\server\boot.js:332:30
W20171020-14:19:45.037(-5)? (STDERR)     at Array.forEach (native)
W20171020-14:19:45.039(-5)? (STDERR)     at Function._.each._.forEach (C:\dev\programs\.meteor\packages\meteor-tool\1.5.2_2\mt-os.windows.x86_32\dev_b
undle\server-lib\node_modules\underscore\underscore.js:79:11)
W20171020-14:19:45.042(-5)? (STDERR)     at C:\dev\R&D\meteor\meteor-test\.meteor\local\build\programs\server\boot.js:158:5
W20171020-14:19:45.043(-5)? (STDERR)     at C:\dev\R&D\meteor\meteor-test\.meteor\local\build\programs\server\boot.js:388:5
W20171020-14:19:45.045(-5)? (STDERR)     at Function.run (C:\dev\R&D\meteor\meteor-test\.meteor\local\build\programs\server\profile.js:510:12)
W20171020-14:19:45.047(-5)? (STDERR)     at C:\dev\R&D\meteor\meteor-test\.meteor\local\build\programs\server\boot.js:387:11
=> Exited with code: 1
=> Your application is crashing. Waiting for file change.
EN

回答 1

Stack Overflow用户

发布于 2017-10-24 14:02:08

在Meteor中编写代码时,您必须注意语法。虽然流星运行在Node.JS之上,但它运行在比大多数NodeJs项目( NodeJS 6.x被认为是LTS)更老的版本上(例如,流星1.5与NodeJS v4.8.x捆绑在一起)。

在您的例子中,看起来像是在for循环中使用let。在NodeJS 7.x (source)之前,似乎不支持此语法。相反,请使用var (这是较旧的Javascript标准)。

在使用流星时,我强烈建议使用预编译语言(如Typescript),因为它使您能够使用现代语法,这些语法将与流星的后续版本兼容(Node 8.x将成为流星1.6的一部分)。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46856362

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档