Keystone: Nuxt.js created app compilation failed

Created on 27 Oct 2019  ·  11Comments  ·  Source: keystonejs/keystone

Bug report

Describe the bug

When using the app generator for Nuxt.js, client side compilation fails with error :

` ERROR Failed to compile with 5 errors friendly-errors 07:37:07

These dependencies were not found: friendly-errors 07:37:07
friendly-errors 07:37:07

  • core-js/modules/es6.regexp.to-string in ./dist/utils.js, ./dist/components/nuxt.js friendly-errors 07:37:07
  • core-js/modules/es7.promise.finally in ./dist/client.js friendly-errors 07:37:07
  • core-js/modules/es7.symbol.async-iterator in ./dist/client.js, ./dist/components/nuxt-link.client.js friendly-errors 07:37:07
    friendly-errors 07:37:07
    To install them, you can run: npm install --save core-js/modules/es6.regexp.to-string core-js/modules/es7.promise.finally core-js/modules/es7.symbol.async-iterator friendly-errors 07:37:07
    `

To Reproduce

  1. nvm use 12
  2. npm init keystone-app test
  3. Choose Nuxt.js
  4. Choose Mongoose
  5. Installation happens (yarn not installed, npm installs dependencies)
  6. Start app with cd test & npm run dev

Expected behaviour

App should compile and start.

Workaround found in https://github.com/vuejs/vue-cli/issues/4391 by forcing core-js to version 2.x

npm install --save core-js@2
npm run dev

System information

  • OS: Linux

Additional context

  • nvm : Now using node v12.13.0 (npm v6.12.0)
  • yarn not installed
bug needs-review

Most helpful comment

try

new NuxtApp({
      srcDir: 'src',
      buildDir: 'dist',
      /*
      ** Build configuration
      */
      build: {
        babel: {
          // envName: server, client, modern
          presets() {
            return [
              [
                '@nuxt/babel-preset-app',
                {
                  useBuiltIns: "entry"
                }
              ]
            ]
          },
        }
      },
    })

All 11 comments

Thanks @bpavot. I did a little more testing

  • I can verify that it is working with yarn on node v10.16.0.
  • I can verify that it is working with yarn on node v12.13.0.
  • I can verify that it is not working with npm on node v12.13.0.
  • I can verify that the todo template is working with npm on node v10.16.0.

So it appears to be a specific combination of Nuxt and NPM. I've pinged @mitchellhamilton who is really good at this stuff and may know what to try. But since this is now well documented I'd say it's a low priority. We'll get to it but most users that encounter this should be able to find an adequate work-around.

Thanks for the detailed report @bpavot, it always helps!

I also encountered this problem.
 

错误报告

描述错误

当将应用生成器用于Nuxt.js时,客户端编译失败并显示以下错误:

`错误编译失败,出现5个错误friendly-errors 07:37:07

找不到这些依赖性:友好错误07:37:07
友好错误07:37:07

  • ./dist/utils.js、./dist/components/nuxt.js中的core-js / modules / es6.regexp.to-string友好错误07:37:07
  • 最终在./dist/client.js中出现core-js / modules / es7.promise.promise-errors 07:37:07
  • ./dist/client.js、./dist/components/nuxt-link.client.js中的core-js / modules / es7.symbol.async-iterator友好错误07:37:07
    友好错误07:37: 07
    要安装它们,您可以运行:npm install --save core-js / modules / es6.regexp.to-string core-js / modules / es7.promise.finally core-js / modules / es7.symbol.async-迭代友好-错误7时37分07秒
    `

重现

  1. nvm使用12
  2. npm初始化keystone-app测试
  3. 选择Nuxt.js
  4. 选择猫鼬
  5. 发生安装(未安装纱线,npm安装依赖项)
  6. 使用cd test和npm run dev启动应用

预期行为

应用程序应编译并启动。

通过将core-js强制为版本2.x 在vuejs / vue-cli#4391中找到解决方法

npm install --save core-js@2
npm run dev

系统信息

  • 操作系统:Linux

其他背景

  • nvm:现在使用节点v12.13.0(npm v6.12.0)
  • 未安装纱

Please try yarn add -D [email protected]

https://stackoverflow.com/questions/54492385/nuxt-js-in-docker-missing-dependencies

try

new NuxtApp({
      srcDir: 'src',
      buildDir: 'dist',
      /*
      ** Build configuration
      */
      build: {
        babel: {
          // envName: server, client, modern
          presets() {
            return [
              [
                '@nuxt/babel-preset-app',
                {
                  useBuiltIns: "entry"
                }
              ]
            ]
          },
        }
      },
    })

Thanks @marxvn. I haven't had time to investigate this yet but if this is something that works for people would you have any insight into the root cause? I'm not sure that adding this the right fix for everyone. It would be great if it just worked regardless of yarn or npm.

@marxvn's solution works for a from-scratch client build with @keystonejs/app-next v5.0.0

@MadeByMike It conflicts with version cuid@^1.3.8 (depends core-js@^1.x) in package @apollographql/graphql-playground-react

I was trying Keystone and this happened.

Using NPM and Node v10.16.3

It looks like there hasn't been any activity here in over 6 months. Sorry about that! We've flagged this issue for special attention. It wil be manually reviewed by maintainers, not automatically closed. If you have any additional information please leave us a comment. It really helps! Thank you for you contribution. :)

try

new NuxtApp({
      srcDir: 'src',
      buildDir: 'dist',
      /*
      ** Build configuration
      */
      build: {
        babel: {
          // envName: server, client, modern
          presets() {
            return [
              [
                '@nuxt/babel-preset-app',
                {
                  useBuiltIns: "entry"
                }
              ]
            ]
          },
        }
      },
    })

Thank you! This worked for me to core-js dependencies issues when I create a new project by yarn create keystone-app my-app.

My versions (if useful):
node: v13.12.0
yarn: 1.22.4

It looks like there hasn't been any activity here in over 6 months. Sorry about that! We've flagged this issue for special attention. It wil be manually reviewed by maintainers, not automatically closed. If you have any additional information please leave us a comment. It really helps! Thank you for you contribution. :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arnaud-zg picture arnaud-zg  ·  18Comments

JedWatson picture JedWatson  ·  17Comments

jossmac picture jossmac  ·  10Comments

thekevinbrown picture thekevinbrown  ·  31Comments

derkweijers picture derkweijers  ·  19Comments