尝试为 Meteor 应用程序提供服务时出现“babel-runtime"错误 [英] Error with 'babel-runtime' while trying to serve a Meteor app

查看:14
本文介绍了尝试为 Meteor 应用程序提供服务时出现“babel-runtime"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

meteor 创建我的项目光盘我的项目流星

服务器抛出以下错误:

<代码>[...]W20161109-03:53:42.862(1)?(STDERR) 错误:在您的 node_modules 中找不到 babel-runtime npm 包W20161109-03:53:42.862(1)?(STDERR) 目录.请运行以下命令进行安装:W20161109-03:53:42.863(1)?(STDERR)W20161109-03:53:42.863(1)?(STDERR) 流星 npm install --save babel-runtime[...]

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

未捕获的错误:找不到模块babel-runtime/helpers/slicedToArray"在 Function.require.resolve

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

  1. 重新安装 NPM 模块rm -rf node_modules流星 npm 安装

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

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

解决方案

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

* 在你的应用中安装 `babel-runtime` npm 包大多数 Babel 转换的代码现在都需要 `node_modules` 目录工作,因为 Meteor `babel-runtime` 包不再尝试提供 Babel 辅助函数的自定义实现.考虑使用最新的候选版本(尚未正式发布)来尝试一下:流星更新--release 1.4.2.1-rc.1接着:流星 npm install --save babel-runtime

升级到 1.4.2.1-rc.1 后(随后于 11 月 9 日早上升级到 1.4.2.1),错误解决.

I have recently been getting off the ground with Meteor and React. I followed the tutorial on the Meteor website with no problem.

Then I tried creating another project, trying to follow another tutorial (for an older version of Meteor). Somewhere along the line, Meteor started throwing up obscure errors. After trying to start fresh again, I ended up reinstalling Meteor and it stopped complaining.

However, I'm getting the same problems, again. Specifically, after creating a brand new project:

meteor create myproject
cd myproject
meteor

The server throws up the following error:

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

I do what I'm told and attempt to install babel-runtime package. The server manages to successfully get off the ground, but it then throws up the following error at run-time:

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

This is all still working off a freshly created project, with no extra packages installed or code changed. I have tried looking online for solutions but, while there are lots of references to bugs that have been fixed, I haven't found anything. A couple of (questions)[Babel - Error: Cannot find module 'babel-runtime/helpers/typeof' on StackOverflow have suggested the following:

  1. Reinstalling the NPM modules rm -rf node_modules meteor npm install

  2. Updating NPM meteor npm update -g npm

I am using Meteor 1.4.2, NPM 3.10.9, Ubuntu 16.04.1.

解决方案

I was having the same issue. After a little digging, found this: 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

After upgrading to 1.4.2.1-rc.1 (and then subsequently upgrading to 1.4.2.1 this morning 11/9), the error was resolved.

这篇关于尝试为 Meteor 应用程序提供服务时出现“babel-runtime"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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