Nuxt.js: JS error with default installation

Created on 19 Mar 2019  路  5Comments  路  Source: nuxt/nuxt.js

Version

v2.4.5

Reproduction link

https://nuxtjs.org/guide/installation

Steps to reproduce

npx create-nuxt-app first-nuxt

? Project name first-nuxt
? Project description My fantastic Nuxt.js project
? Use a custom server framework none
? Choose features to install Linter / Formatter, Prettier, Axios
? Use a custom UI framework tailwind
? Use a custom test framework jest
? Choose rendering mode Universal
? Author name My Name
? Choose a package manager npm

cd first-nuxt && npm run dev

What is expected ?

New application opens without errors

What is actually happening?

ERROR in ./.nuxt/client.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: [BABEL] /Users/.../Projects/training/first-nuxt/.nuxt/client.js: Cannot find module '@babel/preset-env/data/built-ins.json' (While processing: "/Users/.../Projects/training/first-nuxt/node_modules/@nuxt/babel-preset-app/src/index.js")

This bug report is available on Nuxt community (#c8868)
bug-report

Most helpful comment

Same problem here. Manually changing the line in @nuxt/babel-preset-app/src/index.js to use built-in-modules.json instead of built-ins.json seems to fix this problem.

However, if you do this you run into the next problem: isPluginRequired is no longer exported from babel-preset-env. There is already an open issue in the babel repository to fix this: https://github.com/babel/babel/issues/9707

The only workaround I found until this gets fixed is manually running npm i @babel/[email protected] after creating the nuxt app. Afterwards, everything works as expected.

All 5 comments

I'm having the same issue. It can be reproduced with a very minimal setup, just a package.json:

{
  "dependencies": {
    "nuxt": "latest"
  },
  "scripts": {
    "dev": "nuxt"
  }
}

and npm run dev.

I don't think the problem is in nuxt itself though, it occurs in any previous version.

As far as I can tell, it seems to be a problem with @babel/preset-env - data/built-ins.json is missing. It got removed in this commit and v7.4.0 of @babel/preset-env (which was realeased... 2 hours ago?).

Edit
@nuxt/babel-preset-app requires @babel/preset-env/data/built-ins.json directly

Same problem here. Manually changing the line in @nuxt/babel-preset-app/src/index.js to use built-in-modules.json instead of built-ins.json seems to fix this problem.

However, if you do this you run into the next problem: isPluginRequired is no longer exported from babel-preset-env. There is already an open issue in the babel repository to fix this: https://github.com/babel/babel/issues/9707

The only workaround I found until this gets fixed is manually running npm i @babel/[email protected] after creating the nuxt app. Afterwards, everything works as expected.

Still getting the same isPluginRequired error even if i downgrade the @babel/preset-env to 7.3.4. Any ideas?

For me npm i @babel/[email protected] fixed the problem.

Duplicate of #5286

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shyamchandranmec picture shyamchandranmec  路  3Comments

mikekidder picture mikekidder  路  3Comments

gary149 picture gary149  路  3Comments

mattdharmon picture mattdharmon  路  3Comments

vadimsg picture vadimsg  路  3Comments