skip to Main Content

I am getting an error with npm run build within docker build.

When I developed the project about 2 years ago, it worked fine with npm run build,
When I rebuilt my development environment again, I get the error.

ERROR in node_modules/@types/jqueryui/index.d.ts(645,11): error TS1110: Type expected.

I have tried increasing the typescript version on some sites, which improves things, and the error remains in one place.
However, this is the only error I can’t get rid of.
If I delete @types/jqueryui, which is the source of the error, it becomes an error in the development source, which is the package used.

Contents confirmed
(1) Execute as it is.
(2) Change the version of typescript (3) Change the version of @angular/compiler-cliwhich has a dependency withtypescript

Could you please tell me how to eliminate this error?

Details are as follows.

(1) Error contents when executed as is (same contents as when developed about 2 years ago)

 > [build_Hoge-front 10/10] RUN npm run build:
0.594 
0.594 > [email protected] prebuild /usr/src/Hoge/front-end
0.594 > ts-node git.version.ts
0.594 
1.132 The command 'git describe' is successfully executed when pre-build, the result: 'v1.2.0-21-g1f056c8'
1.143 
1.143 > [email protected] build /usr/src/Hoge/front-end
1.143 > ng build --aot --prod --base-href /priv/
1.143 
3.786                                                                                      
16.32 Date: 2024-08-29T05:29:23.872Z
16.32 Hash: 484d03de914203de8543
16.32 Time: 12534ms
16.32 chunk {scripts} scripts.015cc2de5a7b3600d66d.js (scripts) 126 kB  [rendered]
16.32 chunk {0} runtime.a66f828dca56eeb90e02.js (runtime) 1.05 kB [entry] [rendered]
16.32 chunk {1} styles.754e83ac45b0a35831cf.css (styles) 211 kB [initial] [rendered]
16.32 chunk {2} polyfills.57838466c7d879c59877.js (polyfills) 130 bytes [initial] [rendered]
16.32 chunk {3} main.9aedd4c175d67a066c0b.js (main) 128 bytes [initial] [rendered]
16.32 
16.32 
16.32 
16.32 ERROR in node_modules/@types/jquery/JQuery.d.ts(12795,21): error TS1005: ')' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(12795,29): error TS1131: Property or signature expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(12796,24): error TS1005: ';' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(12797,24): error TS1005: ';' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(12798,24): error TS1005: ';' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(12798,59): error TS1128: Declaration or statement expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(12799,13): error TS1128: Declaration or statement expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(12799,41): error TS1005: ';' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(12800,9): error TS1109: Expression expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(12855,25): error TS1005: ',' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(12855,51): error TS1005: ')' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(12855,68): error TS1005: ',' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(12855,83): error TS1005: ',' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(12855,93): error TS1005: ';' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(12855,111): error TS1005: ';' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(12855,112): error TS1128: Declaration or statement expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(12855,113): error TS1128: Declaration or statement expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(12915,12): error TS1005: ';' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13068,33): error TS1005: ',' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13069,13): error TS1109: Expression expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13073,21): error TS1005: ')' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13073,38): error TS1005: ',' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13073,48): error TS1005: ';' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13073,66): error TS1005: ';' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13073,67): error TS1128: Declaration or statement expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13074,5): error TS1128: Declaration or statement expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13074,6): error TS1128: Declaration or statement expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13226,33): error TS1005: ',' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13227,13): error TS1109: Expression expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13231,21): error TS1005: ')' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13231,33): error TS1005: ';' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13231,51): error TS1005: ';' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13231,52): error TS1128: Declaration or statement expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13232,5): error TS1128: Declaration or statement expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13232,6): error TS1128: Declaration or statement expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13363,33): error TS1005: ',' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13364,13): error TS1109: Expression expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13368,21): error TS1005: ')' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13368,38): error TS1005: ',' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13368,48): error TS1005: ';' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13368,76): error TS1005: ';' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13368,77): error TS1128: Declaration or statement expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13369,5): error TS1128: Declaration or statement expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13369,6): error TS1128: Declaration or statement expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13371,7): error TS1005: ',' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13371,16): error TS1005: ';' expected.
16.32 node_modules/@types/jquery/JQuery.d.ts(13372,1): error TS1128: Declaration or statement expected.
16.32 node_modules/@types/jqueryui/index.d.ts(645,11): error TS1110: Type expected.
16.32 
16.35 npm ERR! code ELIFECYCLE
16.35 npm ERR! errno 1
16.35 npm ERR! [email protected] build: `ng build --aot --prod --base-href /priv/`
16.35 npm ERR! Exit status 1
16.35 npm ERR! 
16.35 npm ERR! Failed at the [email protected] build script.
16.35 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
16.36 
16.36 npm ERR! A complete log of this run can be found in:
16.36 npm ERR!     /root/.npm/_logs/2024-08-29T05_29_23_909Z-debug.log
------

 4 warnings found (use docker --debug to expand):
 - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 3)
 - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 18)
 - InvalidBaseImagePlatform: Base image alpine@sha256:3b3f647d2d99cac772ed64c4791e5d9b750dd5fe0b25db653ec4976f7b72837c was pulled with platform "linux/arm64", expected "linux/amd64" for current build (line 33)
 - InvalidBaseImagePlatform: Base image arm64v8/erlang@sha256:a9832017735f81c862faeb36ec84faeda2e12dbc3e2faf351eb381736f7e717b was pulled with platform "linux/arm64", expected "linux/amd64" for current build (line 18)
Hoge-Alpine.Dockerfile:12
--------------------
  10 |     RUN npm install -g [email protected]
  11 |     RUN npm install [email protected] --save
  12 | >>> RUN npm run build
  13 |     
  14 |     # Get Arm based Docker Alpine Linux, including Erlang/OTP 20,
--------------------
ERROR: failed to solve: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1

(2) Error contents when you change the version of typescript in package.json from ~2.7.2 to ~3.4.2 and run it.
(It logs that the dependency between typscript and @angular/compiler-cli does not match)

 > [build_Hoge-front 10/10] RUN npm run build:                                                                                                                                                                         
0.628 
0.628 > [email protected] prebuild /usr/src/Hoge/front-end
0.628 > ts-node git.version.ts
0.628 
1.287 The command 'git describe' is successfully executed when pre-build, the result: 'v1.2.0-25-g1af54fa'
1.299 
1.299 > [email protected] build /usr/src/Hoge/front-end
1.299 > ng build --aot --prod --base-href /priv/
1.299 
2.818 
2.818 @angular/[email protected] requires typescript@'>=2.7.0 <2.8.0' but 3.2.4 was found instead.
2.818 Using this version can result in undefined behaviour and difficult to debug problems.
2.818 
2.818 Please run the following command to install a compatible version of TypeScript.
2.818 
2.818     npm install typescript@'>=2.7.0 <2.8.0'
2.818 
2.818 To disable this warning run "ng config cli.warnings.typescriptMismatch false".
2.818 
4.657                                                                                      
10.64 Date: 2024-09-10T06:27:34.880Z
10.64 Hash: c948bfde79f03a1ebd6a
10.64 Time: 5988ms
10.64 chunk {scripts} scripts.015cc2de5a7b3600d66d.js (scripts) 126 kB  [rendered]
10.64 chunk {0} runtime.a66f828dca56eeb90e02.js (runtime) 1.05 kB [entry] [rendered]
10.64 chunk {1} styles.754e83ac45b0a35831cf.css (styles) 211 kB [initial] [rendered]
10.64 chunk {2} polyfills.57838466c7d879c59877.js (polyfills) 130 bytes [initial] [rendered]
10.64 chunk {3} main.9aedd4c175d67a066c0b.js (main) 128 bytes [initial] [rendered]
10.65 
10.65 
10.65 
10.65 ERROR in The Angular Compiler requires TypeScript >=2.7.2 and <2.10.0 but 3.2.4 was found instead.
10.68 npm ERR! code ELIFECYCLE
10.68 npm ERR! errno 1
10.68 npm ERR! [email protected] build: `ng build --aot --prod --base-href /priv/`
10.68 npm ERR! Exit status 1
10.68 npm ERR! 
10.68 npm ERR! Failed at the [email protected] build script.
10.68 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
10.69 
10.69 npm ERR! A complete log of this run can be found in:
10.69 npm ERR!     /root/.npm/_logs/2024-09-10T06_27_34_917Z-debug.log
------
Hoge.Dockerfile:12
--------------------
  10 |     RUN npm install -g [email protected]
  11 |     RUN npm install [email protected] --save
  12 | >>> RUN npm run build
  13 |     
  14 |     # Get Arm based Docker Alpine Linux, including Erlang/OTP 20,
--------------------
ERROR: failed to solve: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1

(3) Error contents when @angular/compiler-cli is changed from 6.0.3 to 7.2.15 and executed (here and now)

 > [build_Hoge-front 10/10] RUN npm run build:                                                                                                                                                                         
0.887 
0.887 > [email protected] prebuild /usr/src/Hoge/front-end
0.887 > ts-node git.version.ts
0.887 
1.604 The command 'git describe' is successfully executed when pre-build, the result: 'v1.2.0-25-g1af54fa'
1.616 
1.616 > [email protected] build /usr/src/Hoge/front-end
1.616 > ng build --aot --prod --base-href /priv/
1.616 
5.027                                                                                      
20.10 Date: 2024-09-10T06:30:21.762Z
20.10 Hash: 103d6cd95470bbd617e9
20.10 Time: 15077ms
20.10 chunk {scripts} scripts.015cc2de5a7b3600d66d.js (scripts) 126 kB  [rendered]
20.10 chunk {0} runtime.a66f828dca56eeb90e02.js (runtime) 1.05 kB [entry] [rendered]
20.10 chunk {1} styles.754e83ac45b0a35831cf.css (styles) 211 kB [initial] [rendered]
20.10 chunk {2} polyfills.57838466c7d879c59877.js (polyfills) 130 bytes [initial] [rendered]
20.10 chunk {3} main.9aedd4c175d67a066c0b.js (main) 128 bytes [initial] [rendered]
20.10 
20.10 
20.10 
20.10 ERROR in node_modules/@types/jqueryui/index.d.ts(645,11): error TS1110: Type expected.
20.10 
20.14 npm ERR! code ELIFECYCLE
20.14 npm ERR! errno 1
20.14 npm ERR! [email protected] build: `ng build --aot --prod --base-href /priv/`
20.14 npm ERR! Exit status 1
20.14 npm ERR! 
20.14 npm ERR! Failed at the [email protected] build script.
20.14 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
20.15 
20.15 npm ERR! A complete log of this run can be found in:
20.15 npm ERR!     /root/.npm/_logs/2024-09-10T06_30_21_800Z-debug.log
------

 4 warnings found (use docker --debug to expand):
 - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 3)
 - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 18)
 - InvalidBaseImagePlatform: Base image alpine@sha256:3b3f647d2d99cac772ed64c4791e5d9b750dd5fe0b25db653ec4976f7b72837c was pulled with platform "linux/arm64", expected "linux/amd64" for current build (line 33)
 - InvalidBaseImagePlatform: Base image arm64v8/erlang@sha256:a9832017735f81c862faeb36ec84faeda2e12dbc3e2faf351eb381736f7e717b was pulled with platform "linux/arm64", expected "linux/amd64" for current build (line 18)
Hoge.Dockerfile:12
--------------------
  10 |     RUN npm install -g [email protected]
  11 |     RUN npm install [email protected] --save
  12 | >>> RUN npm run build
  13 |     
  14 |     # Get Arm based Docker Alpine Linux, including Erlang/OTP 20,
--------------------
ERROR: failed to solve: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1

Contents of package.json

{
  "name": "Hoge-Test",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --port 8085 --proxy-config proxy.conf.json --host=localhost",
    "build": "ng build --aot --prod --base-href /priv/",
    "prebuild": "ts-node git.version.ts",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.1.7",
    "@angular/cdk": "^6.4.7",
    "@angular/common": "^6.0.3",
    "@angular/compiler": "^6.0.3",
    "@angular/core": "^6.0.3",
    "@angular/forms": "^6.0.3",
    "@angular/http": "^6.0.3",
    "@angular/material": "^6.4.5",
    "@angular/platform-browser": "^6.0.3",
    "@angular/platform-browser-dynamic": "^6.0.3",
    "@angular/router": "^6.0.3",
    "@auth0/angular-jwt": "^2.0.0",
    "@ngx-translate/core": "9.1.1",
    "@ngx-translate/http-loader": "4.0.0",
    "@types/file-saver": "^1.3.0",
    "@types/jquery": "^3.3.9",
    "@types/jqueryui": "^1.12.4",
    "angular-2-local-storage": "^2.0.0",
    "babel-preset-env": "^1.7.0",
    "bootstrap": "^3.3.7",
    "buffer": "^5.2.1",
    "core-js": "^2.5.4",
    "file-saver": "^1.3.8",
    "font-awesome": "^4.7.0",
    "hammerjs": "^2.0.8",
    "iconv-cp932": "^1.0.0",
    "jquery": "^3.3.1",
    "jqueryui": "^1.11.1",
    "js-base64": "^2.5.1",
    "ng-circle-progress": "^1.2.0",
    "ng2-directory-tree": "^0.4.0",
    "ng2-right-click-menu": "^1.0.1",
    "ngx-modal": "0.0.29",
    "ngx-toastr": "^9.0.2",
    "parse-listing-ftp": "^1.1.3",
    "rxjs": "6.2.1",
    "rxjs-compat": "6.2.1",
    "validate-ip-node": "^1.0.6",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular/compiler-cli": "^6.0.3",
    "@angular-devkit/build-angular": "~0.6.8",
    "typescript": "~2.7.2",
    "@angular/cli": "~6.0.8",
    "@angular/language-service": "^6.0.3",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.2.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~1.7.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.0",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.3.0",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1"
  }
}

Contents of dockerfile

FROM node:10.16.3-stretch@sha256:f4b6f471cdd4b66b27eef899e7f8423ecd9fbfc863b2cb7a59978a7f64c8e0c3 as build-front
WORKDIR /usr/src/hoge
COPY .git ./.git
COPY front-end ./front-end
WORKDIR /usr/src/hoge/front-end
RUN apt-get install -y git
RUN npm install
RUN npm install -g [email protected]
RUN npm install [email protected] --save
RUN npm run build

I have tried various ways to improve the situation by changing the package version, but this error has not disappeared.

2

Answers


  1. Chosen as BEST ANSWER

    This issue has been resolved.

    There was a problem specifying the package version in package.json. It seemed to be caused by the package version being updated after 2 years. The build was successful by fixing the following version.

    typescript: ~2.7.2 -> typescript: 2.7.2
    @types/jquery: ^3.3.9 -> @types/jquery: 3.3.9
    @types/jqueryui: ^1.12.4 -> @types/jqueryui: 1.12.4
    

  2. I got the same error, I searched a bit but couldn’t find anything, I think it’s due to version differences.

    Then I replaced type with the code below and the problem was solved, but this may cause some interface problems. I did not encounter any negative situations.

    Replace this type (645) in node_modules/@types/jqueryui/index.d.ts:

    type ResizableThemingClass =
        | "ui-resizable"
        | "ui-resizable-resizing"
        | "ui-resizable-autohide"
        | "ui-resizable-handle"
        | `ui-resizable-${ResizableHandleDirection}`
        | "ui-resizable-ghost"
        | "ui-resizable-helper";
    

    New value:

    type ResizableThemingClass =
        | "ui-resizable"
        | "ui-resizable-resizing"
        | "ui-resizable-autohide"
        | "ui-resizable-handle"
        | "ui-resizable-n"
        | "ui-resizable-e"
        | "ui-resizable-s"
        | "ui-resizable-w"
        | "ui-resizable-ne"
        | "ui-resizable-se"
        | "ui-resizable-sw"
        | "ui-resizable-nw"
        | "ui-resizable-all"
        | "ui-resizable-ghost"
        | "ui-resizable-helper";
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search