Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error with 'babel-runtime' while trying to serve a Meteor app

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.

like image 919
Druckles Avatar asked Feb 06 '23 18:02

Druckles


1 Answers

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.

like image 61
Austin Coose Avatar answered Feb 08 '23 12:02

Austin Coose