Nuxt throws an error when building in docker
Both npm run build
and npm run dev
throw the following error message:
nuxt-ts build
ℹ Production build
ℹ Bundling only for client side
ℹ Target: static
✔ Builder initialized
✔ Nuxt files generated
ℹ Compiling Client
✔ Client: Compiled with some errors in 1.02m
Hash: 69b30fa8ff9adcc01a79
Version: webpack 4.43.0
Time: 60839ms
Built at: 07/20/2020 11:30:50 AM
Asset Size Chunks Chunk Names
LICENSES 1.13 KiB
app.ff3764f.js 57.3 KiB 0 [immutable] app
commons/app.8c6542d.js 236 KiB 1 [immutable] commons/app
commons/pages/workflow.d317470.js 11.6 KiB 2 [immutable] commons/pages/workflow
pages/index.4e60ee5.js 4.68 KiB 3 [immutable] pages/index
pages/workflow.316282a.js 104 KiB 4 [immutable] pages/workflow
runtime.2400a45.js 2.48 KiB 5 [immutable] runtime
vendors~app.40227a7.js 1.08 MiB 6 [immutable] vendors~app
vendors~pages/index.ee43741.js 47.7 KiB 7 [immutable] vendors~pages/index
vendors~pages/workflow.fdf6112.js 699 KiB 8 [immutable] vendors~pages/workflow
Entrypoint app = runtime.2400a45.js commons/app.8c6542d.js vendors~app.40227a7.js app.ff3764f.js
ERROR in layouts/showcaseNavigation/ShowcaseNavigation.vue 62:10-15
TS2339: Property '$nuxt' does not exist on type 'ShowcaseNavigation'.
60 | protected mounted() {
61 |
> 62 | this.$nuxt.$router.afterEach((to, from) => {
| ^^^^^
63 | this.updateBreadCrumb();
64 | })
65 |
ERROR in layouts/showcaseNavigation/ShowcaseNavigation.vue 72:29-34
TS2339: Property '$nuxt' does not exist on type 'ShowcaseNavigation'.
70 | this.breadcrumbs = [];
71 |
> 72 | let path: string = this.$nuxt.$route.path;
| ^^^^^
73 | let pathSplit: string[] = path.split("/");
74 | for(let curCrumb of pathSplit){
75 | if(curCrumb!==""){
ERROR in pages/workflow.vue 15:2-17:3
TS2769: No overload matches this call.
Overload 1 of 2, '(options: ComponentOptions<Vue, DefaultData<Vue>, DefaultMethods<Vue>, DefaultComputed, PropsDefinition<Record<string, any>>, Record<...>> & ThisType<...>): <VC extends VueClass<...>>(target: VC) => VC', gave the following error.
Type 'typeof Demap' is not assignable to type 'VueConstructor<Vue> | AsyncComponentPromise<any, any, any, any> | AsyncComponentFactory<any, any, any, any> | FunctionalComponentOptions<...> | ComponentOptions<...>'.
Type 'typeof Demap' is missing the following properties from type 'VueConstructor<Vue>': extend, nextTick, set, delete, and 9 more.
Overload 2 of 2, '(target: VueClass<Vue>): VueClass<Vue>', gave the following error.
Argument of type '{ components: { Demap: typeof Demap; }; }' is not assignable to parameter of type 'VueClass<Vue>'.
Object literal may only specify known properties, but 'components' does not exist in type 'VueClass<Vue>'. Did you mean to write 'component'?
13 | import Demap from '@digital-earth/frontend-framework/lib/map/Demap.vue';
14 |
> 15 | @Component({
| ^^^^^^^^^^^
> 16 | components: { Demap }
| ^^^^^^^^^^^^^^^^^^^^^^^
> 17 | })
| ^^^
18 | export default class Workflow extends Vue {}
19 | </script>
FATAL Nuxt build error
at WebpackBundler.webpackCompile (node_modules/@nuxt/webpack/dist/webpack.js:5472:21)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at WebpackBundler.build (node_modules/@nuxt/webpack/dist/webpack.js:5421:5)
at Builder.build (node_modules/@nuxt/builder/dist/builder.js:5629:5)
at Generator.initiate (node_modules/@nuxt/generator/dist/generator.js:147:7)
at Generator.generate (node_modules/@nuxt/generator/dist/generator.js:109:5)
at Object.run (node_modules/@nuxt/cli/dist/cli-build.js:103:7)
at NuxtCommand.run (node_modules/@nuxt/cli/dist/cli-index.js:2798:7)
╭─────────────────────────────╮
│ │
│ ✖ Nuxt Fatal Error │
│ │
│ Error: Nuxt build error │
│ │
╰─────────────────────────────╯
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! de-app-template@0.0.1 build: `nuxt-ts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the de-app-template@0.0.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-07-20T11_30_50_423Z-debug.log
The command '/bin/sh -c npm run build' returned a non-zero code: 1
The following dockerfile was used:
FROM nginx
COPY de-app-template-master /app/de-app-template-master
COPY de-frontend-framework-master /app/de-frontend-framework
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get update && \
apt-get install -y git && \
apt-get install -y nodejs
RUN npm install -g npm@latest
WORKDIR /app/de-frontend-framework
RUN npm install
WORKDIR /app/de-app-template-master
RUN npm install
RUN npm run build
RUN cp -a dist/. /usr/share/nginx/html/