尝试提供Meteor应用程序时出现'babel-runtime'错误

Dru*_*les 3 node.js meteor babeljs

我最近开始使用Meteor和React.我按照Meteor网站上的教程没有问题.

然后我尝试创建另一个项目,尝试遵循另一个教程(对于旧版本的Meteor).在某个地方,Meteor开始抛出晦涩难懂的错误.在尝试重新开始后,我最终重新安装了Meteor,它停止了抱怨.

但是,我又遇到了同样的问题.具体来说,在创建一个全新的项目后:

meteor create myproject
cd myproject
meteor
Run Code Online (Sandbox Code Playgroud)

服务器抛出以下错误:

[...]
W20161109-03:53:42.862(1)? (STDERR) Error: The babel-runtime npm package could not be found in your node_modules
W20161109-03:53:42.862(1)? (STDERR) directory. Please run the following command to install it:
W20161109-03:53:42.863(1)? (STDERR)
W20161109-03:53:42.863(1)? (STDERR)   meteor npm install --save babel-runtime
[...]
Run Code Online (Sandbox Code Playgroud)

我按照我所说的去尝试安装babel-runtime包.服务器设法成功启动,但它在运行时抛出以下错误:

Uncaught Error: Cannot find module 'babel-runtime/helpers/slicedToArray'
at Function.require.resolve
Run Code Online (Sandbox Code Playgroud)

这仍然是一个新创建的项目,没有安装额外的包或代码更改.我曾尝试在网上寻找解决方案,但是,虽然有许多已经修复的错误的引用,但我还没有找到任何东西.几个(问题)[ Babel - 错误:在StackOverflow上找不到模块'babel-runtime/helpers/typeof'提示如下:

  1. 重新安装NPM模块rm -rf node_modules meteor npm install

  2. 更新NPM流星npm update -g npm

我使用的是Meteor 1.4.2,NPM 3.10.9,Ubuntu 16.04.1.

Aus*_*ose 7

我遇到了同样的问题.经过一番挖掘,发现了这个:https://github.com/meteor/meteor/issues/8019

* Installing the `babel-runtime` npm package in your application
  `node_modules` directory is now required for most Babel-transformed code
  to work, as the Meteor `babel-runtime` package no longer attempts to
  provide custom implementations of Babel helper functions.
Consider trying it out by using the latest release candidate (not officially released yet):

meteor update --release 1.4.2.1-rc.1
And then:

meteor npm install --save babel-runtime
Run Code Online (Sandbox Code Playgroud)

升级到1.4.2.1-rc.1(然后在今天上午11/9升级到1.4.2.1)之后,错误得到了解决.