流星不会开始。js中“块范围的声明(let, const, function, class)在严格模式之外还不支持”

时间:2021-09-29 16:41:06

I'm new to Meteor, and only trying to install and get a new app running. I had things were working last Friday, but had to reinstall today and can no longer get the app running.

我对《流星》很陌生,只是想安装并运行一个新的应用程序。上周五我的东西还在运行,但今天不得不重新安装,无法继续运行。

The install has been a challenge. Trying to install on Windows, and have found the installers just don't work. Resorted to extracting a tar.gz file. Also, due to company restrictions, had to install to an alternate location (the default in %LocalAppData% is locked down by policy). But, as I said, this was working last week, but can't get it working today. Others on the team started seeing this, this week too. When running meteor for the first time, it updates to meteor-tool to 1.5.2.2, then updates various packages. The ejson package is one, and is updated to 1.0.14. If I run meteor update it says project is already at 1.5.2.2. (the latest) and top-level dependencies are at their latest compatible versions. How do I fix this? Thanks!

安装是一个挑战。试图在Windows上安装,却发现安装程序不起作用。诉诸于提取焦油。gz文件。此外,由于公司的限制,必须安装到另一个位置(%LocalAppData%的默认值被策略锁定)。但是,就像我说的,这在上周是有效的,但是今天不能起作用。团队中的其他人也开始看到了这一点。当第一次运行流星时,它更新到meteor-tool 1.5.2.2,然后更新各种包。ejson包是一个,被更新为1.0.14。如果我运行流星更新,它说项目已经在1.5.2.2。(最新的)和*依赖项都是最新的兼容版本。我怎么解决这个问题?谢谢!

Console Output:

控制台输出:

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.

1 个解决方案

#1


0  

You have to be careful about syntax when writing code in Meteor. Although Meteor runs ontop of Node.JS, it runs on an older version (Meteor 1.5 is bundled with NodeJs v4.8.x for instance) than most NodeJS projects (NodeJS6.x is considered LTS).

在使用流星编写代码时,必须注意语法。虽然流星在节点上运行。它运行在一个老版本上(流星1.5与NodeJs v4.8捆绑在一起)。例如)比大多数NodeJS项目(NodeJS6。x是LTS)。

In your case, it looks like you are using let inside of a for loop. It doesn't look like this syntax is supported until NodeJS 7.x (source). Instead, use var (which is the older Javascript standard).

在您的示例中,看起来您使用的是for循环中的let。直到NodeJS 7才支持这种语法。x(源)。相反,使用var(旧的Javascript标准)。

When working with Meteor, I would highly suggest using a pre-compiled language (like Typescript), as it enables you to use modern syntax which will be compatible with later versions of Meteor (Node 8.x will be a part of Meteor 1.6).

当使用流星时,我强烈建议使用预编译语言(比如Typescript),因为它使您能够使用现代语法,它将与稍后版本的流星(节点8)兼容。x将是流星1.6的一部分。

#1


0  

You have to be careful about syntax when writing code in Meteor. Although Meteor runs ontop of Node.JS, it runs on an older version (Meteor 1.5 is bundled with NodeJs v4.8.x for instance) than most NodeJS projects (NodeJS6.x is considered LTS).

在使用流星编写代码时,必须注意语法。虽然流星在节点上运行。它运行在一个老版本上(流星1.5与NodeJs v4.8捆绑在一起)。例如)比大多数NodeJS项目(NodeJS6。x是LTS)。

In your case, it looks like you are using let inside of a for loop. It doesn't look like this syntax is supported until NodeJS 7.x (source). Instead, use var (which is the older Javascript standard).

在您的示例中,看起来您使用的是for循环中的let。直到NodeJS 7才支持这种语法。x(源)。相反,使用var(旧的Javascript标准)。

When working with Meteor, I would highly suggest using a pre-compiled language (like Typescript), as it enables you to use modern syntax which will be compatible with later versions of Meteor (Node 8.x will be a part of Meteor 1.6).

当使用流星时,我强烈建议使用预编译语言(比如Typescript),因为它使您能够使用现代语法,它将与稍后版本的流星(节点8)兼容。x将是流星1.6的一部分。