gpt4 book ai didi

node.js - Nuxt 的 Docker 构建缺少 core-js 依赖项

转载 作者:行者123 更新时间:2023-12-02 18:26:16 27 4
gpt4 key购买 nike

我一直在尝试在 docker 中运行我的 nuxt 应用程序,并且构建似乎在大多数情况下都可以正常工作,除了它一直缺少 core.js 依赖项。我尝试手动添加 core-js,babel,尝试在错误中运行建议的安装命令,但没有帮助。
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"]
运行时 nuxt 构建错误:
ERROR 编译失败,出现 53 个错误
未找到这些依赖项:
* 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
构建日志:
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.
用于运行容器的命令:
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

最佳答案

前几天我也遇到了这个错误。有两种解决方案:删除并重新安装所有 Node 模块,或者将其添加到配置文件中:

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 }
}
]
]
}
}
}
}

关于node.js - Nuxt 的 Docker 构建缺少 core-js 依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62501491/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com