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

标签 node.js meteor babeljs

我最近开始接触 Meteor 和 React。我关注了tutorial在 Meteor 网站上没有问题。

然后我尝试创建另一个项目,试图跟随另一个 tutorial (对于旧版本的 Meteor)。沿线的某个地方,Meteor 开始抛出模糊的错误。在尝试重新开始后,我最终重新安装了 Meteor,它不再提示了。

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

meteor create myproject
cd myproject
meteor

服务器抛出以下错误:

[...]
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
[...]

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

Uncaught Error: Cannot find module 'babel-runtime/helpers/slicedToArray'
at Function.require.resolve

这一切仍在新创建的项目中进行,没有安装额外的包或更改代码。我曾尝试在网上寻找解决方案,但是,虽然有很多关于已修复错误的引用资料,但我什么也没找到。几个(问题)[ Babel - Error: Cannot find module 'babel-runtime/helpers/typeof'在 StackOverflow 上提出了以下建议:

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

  2. 更新 NPM meteor npm 更新 -g npm

我正在使用 Meteor 1.4.2、NPM 3.10.9、Ubuntu 16.04.1。

最佳答案

我遇到了同样的问题。经过一番挖掘,发现了这个: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

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

关于node.js - 尝试提供 Meteor 应用程序时出现 'babel-runtime' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40499685/

相关文章:

javascript - Meteor JS 在没有模板的情况下首先加载 : gives "null" error

node.js - 找不到模块 babel-preset-es2015

node.js - 缺少 npm Gulp 依赖项,即使在运行 npm install 之后

javascript - 迭代深度嵌套的 JavaScript 对象并获取键路径

javascript - meteor :如何在显示时操作 Mongodb 数据

meteor - 如何列出文件夹中的文件

Angular 9 Uncaught ReferenceError : regeneratorRuntime is not defined

reactjs - ES6 React istanbul 未收集覆盖率信息,退出时不写入覆盖率信息

javascript - Sequelize ,其中relation.attribute 等于

node.js - npm ffmpeg-binaries 安装失败