typescript - Angular-appdistribution i produktion - får olika cli-version
Jag försöker distribuera min Angular-applikation i Jenkins. Jag använder Jenkins och Docker för att bygga och distribuera i produktion.
Mitt package.json har angular/compiler-cli: 7.0.3, men jag ser i Jenkins-konsolen att det står 7.1.2. Kan någon vänligen hjälpa mig att förstå varför det är annorlunda?
Jag får också fel: angular/[email kräver typescript@'>=3.1.1 <3.2' men 3.2.2 hittades istället. -> för din information: jag har redan RUN npm install [email i min dockerfile och det installeras också (jag kan se det i Jenkins-konsolen).
package.json:
"dependencies": {
"@angular/cdk": "^7.0.4",
"@angular/common": "^7.0.3",
"@angular/compiler": "^7.0.3",
"@angular/core": "^7.0.3",
"@angular/forms": "^7.0.3",
"@angular/http": "^7.0.3",
. . .
. . .
. . .
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.10.3",
"@angular/cli": "^7.0.5",
"@angular/compiler-cli": "^7.0.3",
. . .
. . .
. . .
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "^3.1.6"
}
Dockerfil :
---- Base Node ----
FROM node:carbon AS base
FROM tiangolo/node-frontend:10 as build-stage
Create app directory
WORKDIR /app
---- Dependencies ----
FROM base AS dependencies
A wildcard is used to ensure both package.json AND package-lock.json are copied
COPY package*.json /app/
install app dependencies including 'devDependencies'
RUN npm install
RUN npm install angular -g
RUN npm install [email
#RUN ng update
#RUN npm update
---- Copy Files/Build ----
COPY ./ /app/
ARG configuration=production
RUN npm run build -- --output-path=./dist/out --configuration $configuration
Fel i Jenkins-konsolen:
Step 3/12 : COPY package*.json /app/
---> c58c4341ccf1
Step 4/12 : RUN npm install
---> Running in b779f562e7d1
> [email install /app/node_modules/node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.9.3/linux-x64-64_binding.node
Download complete
Binary saved to /app/node_modules/node-sass/vendor/linux-x64-64/binding.node
Caching binary to /root/.npm/node-sass/4.9.3/linux-x64-64_binding.node
> [email postinstall /app/node_modules/node-sass
> node scripts/build.js
Binary found at /app/node_modules/node-sass/vendor/linux-x64-64/binding.node
Testing binary
Binary is fine
> [email postinstall /app/node_modules/angular-ide
> node ./scripts/post.js
[91mnpm WARN[0m[91m lifecycle [email ~postinstall: cannot run in wd [email node patch.js (wd=/app)
[0m[91mnpm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email : wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
[0madded 1266 packages from 1241 contributors, removed 8 packages, updated 7 packages and audited 50062 packages in 53.101s
found 0 vulnerabilities
Removing intermediate container b779f562e7d1
---> 853256b9e94a
Step 5/12 : RUN npm install angular -g
---> Running in 377f5b1fb516
+ [email
added 1 package from 1 contributor in 0.659s
Removing intermediate container 377f5b1fb516
---> a18cf57ae160
Step 6/12 : RUN npm install [email
---> Running in 0fad7871d368
[91mnpm WARN[0m[91m @angular/[email requires a peer of @angular/[email but none is installed. You must install peer dependencies yourself.
[0m[91mnpm [0m[91mWARN @angular/[email requires a peer of @angular/[email but none is installed. You must install peer dependencies yourself.
[0m[91mnpm [0m[91mWARN [email requires a peer of @angular/core@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm [0m[91mWARN [email requires a peer of @angular/http@^5.0.0 but none is installed. You must install peer dependencies yourself.
[0m[91mnpm WARN[0m[91m [email requires a peer of rxjs@^5.5.2 but none is installed. You must install peer dependencies yourself.
npm[0m[91m WARN [email requires a peer of @angular/common@^6.0.1 but none is installed. You must install peer dependencies yourself.
[0m[91mnpm WARN[0m[91m [email requires a peer of @angular/core@^6.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN[0m[91m [email requires a peer of @angular/forms@^6.0.1 but none is installed. You must install peer dependencies yourself.
[0m[91mnpm [0m[91mWARN optional SKIPPING OPTIONAL DEPENDENCY: [email (node_modules/fsevents):
npm[0m[91m WARN notsup[0m[91m SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email : wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
[0m[91m
[0m+ [email
updated 1 package and audited 50062 packages in 12.661s
found 0 vulnerabilities
Removing intermediate container 0fad7871d368
---> 90d01e19e304
Step 7/12 : COPY ./ /app/
Resuming build at Mon Dec 10 09:05:56 CST 2018 after Jenkins restart
Waiting to resume part of IQS-WEB #12: ???
Ready to run at Mon Dec 10 09:06:08 CST 2018
---> f640df25e979
Step 8/12 : ARG configuration=production
---> Running in f71224f70ead
Removing intermediate container f71224f70ead
---> e276ace419a8
Step 9/12 : RUN npm run build -- --output-path=./dist/out --configuration $configuration
---> Running in 70e25196b650
> [email build /app
> ng build "--output-path=./dist/out" "--configuration" "production"
[91m
@angular/[email requires typescript@'>=3.1.1 <3.2' but 3.2.2 was found instead.
Using this version can result in undefined behaviour and difficult to debug problems.
Please run the following command to install a compatible version of TypeScript.
npm install typescript@">=3.1.1 <3.2"
To disable this warning run "ng config cli.warnings.typescriptMismatch false".
[0m
Date: 2018-12-10T15:06:44.098Z
Hash: dad34d5f1324a7bda1cb
Time: 7418ms
chunk {scripts} scripts.08fbed0cc1e97e0c177b.js (scripts) 142 kB [rendered]
chunk {0} runtime.ec2944dd8b20ec099bf3.js (runtime) 1.41 kB [entry] [rendered]
chunk {1} main.9868d9b237c3a48c54da.js (main) 128 bytes [initial] [rendered]
chunk {2} polyfills.85f47f0bf59079cbc23a.js (polyfills) 130 bytes [initial] [rendered]
chunk {3} styles.ec522b2ad67e374b5ac2.css (styles) 157 kB [initial] [rendered]
[91m
ERROR in The Angular Compiler requires TypeScript >=3.1.1 and <3.2.0 but 3.2.2 was found instead.
[0m[91mnpm ERR! code ELIFECYCLE
[0m[91mnpm ERR! errno 1
Svar #1
Versionen av TypeScript i din package.json är "typescript": "^3.1.6". Detta betyder att den kommer att använda den senaste stora versionen (andra numret i x.y.z), och den använder 3.2.2, som konsolens FEL visar. Ta bort ^ från TypeScript-versionen.
Svar #2
Du har definierat din "angular-cli"-paketversion inte strikt, utan för att stödja uppgradering till den nyaste versionen upp till max huvuduppdatering automatiskt: "@angular/cli": "^7.0.5".
Ange bara strikt, utan "^": "@angular/cli": "7.0.5"