我最近刚开始使用Meteor和React。我没有任何问题地跟踪了Meteor网站上的tutorial。
然后,我尝试创建另一个项目,尝试遵循另一个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
这一切仍在一个新创建的项目上进行,没有安装任何额外的程序包或更改代码。我曾尝试在网上寻找解决方案,但是尽管有很多关于已修复的错误的引用,但我什么都没找到。 StackOverflow上的几个(问题)[Babel - Error: Cannot find module 'babel-runtime/helpers/typeof'提出以下建议:
rm -rf node_modules
meteor 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)之后,该错误已解决。