Docker build of Nuxt missing core-js dependencies

南楼画角 提交于 2021-01-28 04:00:42

问题


I've been trying to run my nuxt app in docker and the build seem to work for the most part other than it keep missing core.js dependencie. I've tried adding core-js manually, babel, tried to run the suggested install command in the error, but to no help.

Dockerfile:

FROM node:12.2.0-alpine

WORKDIR /app    

ENV PATH /app/node_modules/.bin:$PATH    

COPY package.json /app/package.json
RUN yarn install    

CMD ["yarn", "dev"]

Runtime nuxt build error:

ERROR Failed to compile with 53 errors

These dependencies were not found:

* core-js/modules/es6.array.find in ./.nuxt/client.js
* core-js/modules/es6.array.from in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js
* core-js/modules/es6.array.iterator in ./.nuxt/client.js
* core-js/modules/es6.date.to-string in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js
* core-js/modules/es6.function.name in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js and 2 others
* core-js/modules/es6.number.constructor in ./node_modules/babel-loader/lib??ref--2-0!./node_modules/@nuxt/components/dist/loader.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./components/ExperienceBarComponent.vue?vue&type=script&lang=js&
* core-js/modules/es6.object.assign in ./.nuxt/client.js
* core-js/modules/es6.object.keys in ./.nuxt/client.js, ./node_modules/babel-loader/lib??ref--2-0!./node_modules/@nuxt/components/dist/loader.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./components/MailComponent.vue?vue&type=script&lang=js& and 1 other
* core-js/modules/es6.object.to-string in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js and 3 others
* core-js/modules/es6.promise in ./.nuxt/client.js
* core-js/modules/es6.regexp.constructor in ./.nuxt/utils.js
* core-js/modules/es6.regexp.match in ./.nuxt/client.js
* core-js/modules/es6.regexp.replace in ./.nuxt/client.js, ./.nuxt/components/nuxt.js and 1 other
* core-js/modules/es6.regexp.search in ./.nuxt/utils.js
* core-js/modules/es6.regexp.split in ./.nuxt/utils.js, ./node_modules/babel-loader/lib??ref--2-0!./node_modules/@nuxt/components/dist/loader.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./.nuxt/components/nuxt-build-indicator.vue?vue&type=script&lang=js&
* core-js/modules/es6.regexp.to-string in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js
* core-js/modules/es6.string.includes in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js and 1 other
* core-js/modules/es6.string.iterator in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js
* core-js/modules/es6.string.repeat in ./.nuxt/utils.js
* core-js/modules/es6.string.starts-with in ./.nuxt/utils.js
* core-js/modules/es6.symbol in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js and 1 other
* core-js/modules/es7.array.includes in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js and 1 other
* core-js/modules/es7.object.get-own-property-descriptors in ./.nuxt/index.js, ./static/svg/hearth.svg?inline
* core-js/modules/es7.promise.finally in ./.nuxt/client.js
* core-js/modules/es7.symbol.async-iterator in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js
* core-js/modules/web.dom.iterable in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js and 2 others

To install them, you can run: npm install --save core-js/modules/es6.array.find core-js/modules/es6.array.from core-js/modules/es6.array.iterator core-js/modules/es6.date.to-string core-js/modules/es6.function.name core-js/modules/es6.number.constructor core-js/modules/es6.object.assign core-js/modules/es6.object.keys core-js/modules/es6.object.to-string core-js/modules/es6.promise core-js/modules/es6.regexp.constructor core-js/modules/es6.regexp.match core-js/modules/es6.regexp.replace core-js/modules/es6.regexp.search core-js/modules/es6.regexp.split core-js/modules/es6.regexp.to-string core-js/modules/es6.string.includes core-js/modules/es6.string.iterator core-js/modules/es6.string.repeat core-js/modules/es6.string.starts-with core-js/modules/es6.symbol core-js/modules/es7.array.includes core-js/modules/es7.object.get-own-property-descriptors core-js/modules/es7.promise.finally core-js/modules/es7.symbol.async-iterator core-js/modules/web.dom.iterable

Build log:

Deploying 'personalPortfolio Dockerfile: Dockerfile'...
Building image...
Preparing build context archive...
[==================================================>]94/94 files
Done

Sending build context to Docker daemon...
[==================================================>] 425,6kB
Done

Step 1/6 : FROM node:12.2.0-alpine
 ---> f391dabf9dce
Step 2/6 : WORKDIR /app
 ---> Running in 9d137ab94be2
Removing intermediate container 9d137ab94be2
 ---> 078262caa13f
Step 3/6 : ENV PATH /app/node_modules/.bin:$PATH
 ---> Running in 17e3b89345fc
Removing intermediate container 17e3b89345fc
 ---> b58f5e3e80c4
Step 4/6 : COPY package.json /app/package.json
 ---> 0d83547912ef
Step 5/6 : RUN yarn install
 ---> Running in c1f05fd932c4
yarn install v1.15.2
info No lockfile found.
[1/4] Resolving packages...
warning @nuxtjs/apollo > vue-cli-plugin-apollo > nodemon > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning @nuxtjs/apollo > vue-cli-plugin-apollo > nodemon > chokidar > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning @nuxtjs/apollo > vue-cli-plugin-apollo > nodemon > chokidar > braces > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning @nuxtjs/apollo > vue-cli-plugin-apollo > nodemon > chokidar > braces > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning @nuxtjs/style-resources > sass-resources-loader > @babel/cli > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning nuxt > @nuxt/webpack > @nuxt/babel-preset-app > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning nuxt > @nuxt/webpack > webpack > watchpack > watchpack-chokidar2 > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning node-sass > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning node-sass > node-gyp > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
[2/4] Fetching packages...
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.3: The platform "linux" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > @nuxtjs/apollo@4.0.0-rc9" has unmet peer dependency "apollo-cache-inmemory@^1.6.2".
warning "@nuxtjs/apollo > vue-apollo@3.0.3" has unmet peer dependency "apollo-client@^2.0.0".
warning "@nuxtjs/apollo > vue-apollo@3.0.3" has unmet peer dependency "apollo-link@^1.0.0".
warning "@nuxtjs/apollo > vue-apollo@3.0.3" has unmet peer dependency "graphql-tag@^2.10.1".
warning "@nuxtjs/apollo > vue-cli-plugin-apollo@0.21.3" has unmet peer dependency "@vue/cli-shared-utils@^3.0.0 || ^4.0.0-0".
warning "@nuxtjs/apollo > vue-cli-plugin-apollo > ts-node@8.10.2" has unmet peer dependency "typescript@>=2.7".
warning "@nuxtjs/markdownit > raw-loader@4.0.1" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/cli@7.10.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env@7.10.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/helper-compilation-targets@7.10.2" has unmet peer dependency "@babel/core@^7.0.0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-proposal-async-generator-functions@7.10.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-proposal-dynamic-import@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-proposal-json-strings@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-proposal-class-properties@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-proposal-numeric-separator@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-proposal-nullish-coalescing-operator@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-proposal-object-rest-spread@7.10.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-proposal-optional-catch-binding@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-proposal-private-methods@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-proposal-optional-chaining@7.10.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-proposal-unicode-property-regex@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-syntax-async-generators@7.8.4" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-syntax-dynamic-import@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-syntax-nullish-coalescing-operator@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-syntax-json-strings@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-syntax-class-properties@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-syntax-numeric-separator@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-syntax-optional-chaining@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-syntax-optional-catch-binding@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-syntax-object-rest-spread@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-syntax-top-level-await@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-arrow-functions@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-async-to-generator@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-block-scoping@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-block-scoped-functions@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-computed-properties@7.10.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-destructuring@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-dotall-regex@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-classes@7.10.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-exponentiation-operator@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-duplicate-keys@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-literals@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-for-of@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-member-expression-literals@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-function-name@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-modules-amd@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-named-capturing-groups-regex@7.10.3" has unmet peer dependency "@babel/core@^7.0.0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-modules-systemjs@7.10.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-modules-umd@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-modules-commonjs@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-new-target@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-object-super@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-property-literals@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-regenerator@7.10.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-parameters@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-reserved-words@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-shorthand-properties@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-spread@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-sticky-regex@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-template-literals@7.10.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/preset-modules@0.1.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-typeof-symbol@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-unicode-escapes@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-transform-unicode-regex@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-proposal-unicode-property-regex > @babel/helper-create-regexp-features-plugin@7.10.1" has unmet peer dependency "@babel/core@^7.0.0".
warning "@nuxtjs/style-resources > sass-resources-loader > @babel/preset-env > @babel/plugin-proposal-class-properties > @babel/helper-create-class-features-plugin@7.10.3" has unmet peer dependency "@babel/core@^7.0.0".
warning "@nuxtjs/svg > vue-svg-loader@0.16.0" has unmet peer dependency "vue-template-compiler@^2.0.0".
warning "@nuxtjs/svg > url-loader@4.1.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning "@nuxtjs/svg > file-loader@6.0.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning "@nuxtjs/svg > vue-svg-loader > svg-to-vue@0.7.0" has unmet peer dependency "vue-template-compiler@^2.0.0".
warning "@nuxtjs/eslint-config > eslint-plugin-vue@5.2.3" has incorrect peer dependency "eslint@^5.0.0".
warning "@nuxtjs/eslint-config > eslint-plugin-vue > vue-eslint-parser@5.0.0" has incorrect peer dependency "eslint@^5.0.0".
warning "@nuxtjs/eslint-module > eslint-loader@4.0.2" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning " > sass-loader@8.0.2" has unmet peer dependency "webpack@^4.36.0 || ^5.0.0".
[4/4] Building fresh packages...
success Saved lockfile.
Done in 70.39s.
Removing intermediate container c1f05fd932c4
 ---> 3de73d894529
Step 6/6 : CMD ["yarn", "dev"]
 ---> Running in 818d77851c2f
Removing intermediate container 818d77851c2f
 ---> 1299c21f9593

Successfully built 1299c21f9593
Successfully tagged personal-portfolio:dev
Creating container...
Container Id: 670001ae3e42cde8c764a1c32c41ab2b516703a62172627371a504e34b2f3495
Container name: 'personalPortfolio'
Attaching to container 'personalPortfolio'...
Starting container 'personalPortfolio'
'personalPortfolio Dockerfile: Dockerfile' has been deployed successfully.

Command used to run the container:

docker build -t personal-portfolio:dev .
&& docker run
-p 3001:3000
-v D:\WindowsFolders\Desktop\Programming\Javascript\personalPortfolio:/app
--env NUXT_TELEMETRY_DISABLED=1
--name personalPortfolio
-v /app/node_modules
personal-portfolio:dev

回答1:


I ran into this error the other day as well. There are two solutions: delete and reinstall all your node modules, or add this to your config file:

export default {
  build: {
    babel: {
      presets({ isServer }) {
        return [
          [
            require.resolve('@nuxt/babel-preset-app'),
            // require.resolve('@nuxt/babel-preset-app-edge'), // For nuxt-edge users
            {
              buildTarget: isServer ? 'server' : 'client',
              corejs: { version: 3 }
            }
          ]
        ]
      }
    }
  }
}



回答2:


This had nothing to do with docker. I'm not sure how, but at some point reinstalling all the node modules installed the wrong core-js version.

Installing "core-js": "^2" seems to have solved it for now. Perhaps upgrading nuxt version would help too.



来源:https://stackoverflow.com/questions/62501491/docker-build-of-nuxt-missing-core-js-dependencies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!