Docker: [error] TypeError: Cannot read property 'Workspace' of undefined
See original GitHub issueHello i have been experimenting this error when building on a docker image for quite some time now. I have also been trying different versions of angular dependencies around angular 12.
The error:
[error] TypeError: Cannot read property ‘Workspace’ of undefined at Object.getWorkspace (/opt/atlassian/pipelines/agent/build/node_modules/@angular/cli/utilities/config.js:66:57) at BuildCommand.validateScope (/opt/atlassian/pipelines/agent/build/node_modules/@angular/cli/models/command.js:97:67) at BuildCommand.validateAndRun (/opt/atlassian/pipelines/agent/build/node_modules/@angular/cli/models/command.js:122:24) at Object.runCommand (/opt/atlassian/pipelines/agent/build/node_modules/@angular/cli/models/command-runner.js:201:38) at process._tickCallback (internal/process/next_tick.js:68:7) at Function.Module.runMain (internal/modules/cjs/loader.js:834:11) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
🐞 Bug report
- new
- [x ] build
- serve
- test
- e2e
- generate
- add
- update
- lint
- extract-i18n
- run
- config
- help
- version
- doc
Is this a regression?
It seems to work with version 9
Description
The error happens when building on a docker image with a bitbucket pipeline. It does work when building on a windows local machine with the command: ng build --configuration=production && ng run safesante-ysera-front:server --configuration=production && npm run pack
🔬 Minimal Reproduction
ng build --configuration=production && ng run safesante-ysera-front:server --configuration=production && npm run pack
with the following configuration:
{ “version”: 1, “newProjectRoot”: “projects”, “projects”: { “safesante-ysera-front”: { “root”: “”, “sourceRoot”: “src”, “projectType”: “application”, “prefix”: “app”,
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/safesante-ysera-front",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets",
{
"glob": "**/*",
"input": "node_modules/ngx-extended-pdf-viewer/assets/",
"output": "/assets/"
}
],
"styles": [
"node_modules/font-awesome/css/font-awesome.min.css",
"node_modules/@fortawesome/fontawesome-free/css/all.min.css",
"node_modules/font-awesome-animation/dist/font-awesome-animation.css",
"node_modules/font-awesome-animation/dist/font-awesome-animation.min.css",
"node_modules/weather-icons/css/weather-icons.min.css",
"design/css/fullcalendar-vendor.min.css",
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"node_modules/angular2-multiselect-dropdown/themes/default.theme.css",
"src/material-icons-font-face.scss",
"src/ysera-styles-caro.css",
"src/ysera-styles-faycal.css",
"src/ysera-styles-max.css",
"src/styles.scss"
],
"scripts": [
"./node_modules/jquery/dist/jquery.min.js",
"./node_modules/bootstrap/dist/js/bootstrap.min.js",
"./node_modules/detectrtc/DetectRTC.js",
"src/assets/picture-in-picture.js",
"src/assets/lib-jitsi-meet/lib-jitsi-meet.min.js",
"./node_modules/fast-levenshtein/levenshtein.js",
"node_modules/@fortawesome/fontawesome-free/js/all.min.js"
],
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
"aot": true,
"sourceMap": true,
"optimization": false,
"namedChunks": true
},
"configurations": {
"production": {
"budgets": [],
"index": {
"input": "src/index.production.html",
"output": "index.html"
},
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"assets": [
"src/favicon.ico",
"src/assets",
{
"glob": "**/*",
"input": "node_modules/ngx-extended-pdf-viewer/assets/",
"output": "/assets/"
},
{
"glob": "Procfile",
"input": "src/",
"output": "./"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"aot": true,
"buildOptimizer": true
},
"development": {
"budgets": []
},
"remote": {
"budgets": [],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.remote.ts"
}
]
}
},
"defaultConfiguration": ""
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "safesante-ysera-front:build"
},
"configurations": {
"production": {
"browserTarget": "safesante-ysera-front:build:production",
"proxyConfig": "proxy-production.config.json"
},
"development": {
"browserTarget": "safesante-ysera-front:build:development",
"proxyConfig": "proxy-development.config.json"
},
"remote": {
"browserTarget": "safesante-ysera-front:build:remote",
"proxyConfig": "proxy-remote.config.json"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "safesante-ysera-front:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.css"
],
"scripts": [],
"assets": [
"favicon.png",
"src/assets",
{
"glob": "**/*",
"input": "node_modules/ngx-extended-pdf-viewer/assets/locale",
"output": "/assets/locale/"
}
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"server": {
"builder": "@angular-devkit/build-angular:server",
"options": {
"outputPath": "dist/safesante-ysera-server",
"main": "server.ts",
"tsConfig": "src/tsconfig.server.json",
"sourceMap": true,
"optimization": false
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
}
},
"assets": [
{
"input": "src/Procfile",
"output": "./"
}
],
"defaultConfiguration": ""
},
"serve-ssr": {
"builder": "@nguniversal/builders:ssr-dev-server",
"options": {
"browserTarget": "safesante-ysera-front:build",
"serverTarget": "safesante-ysera-front:server"
},
"configurations": {
"production": {
"browserTarget": "safesante-ysera-front:build:production",
"serverTarget": "safesante-ysera-front:server:production",
"proxyConfig": "proxy-production.config.json"
}
}
},
"prerender": {
"builder": "@nguniversal/builders:prerender",
"options": {
"browserTarget": "safesante-ysera-front:build:production",
"serverTarget": "safesante-ysera-front:server:production",
"routes": [
"/"
]
},
"configurations": {
"production": {}
}
}
}
},
"safesante-ysera-front-e2e": {
"root": "e2e/",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "safesante-ysera-front:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
}, “defaultProject”: “safesante-ysera-front”, “cli”: { “analytics”: false } }
🔥 Exception or Error
ng build --configuration=production && ng run safesante-ysera-front:server --configuration=production && npm run pack An unhandled exception occurred: Cannot read property ‘Workspace’ of undefined See “/tmp/ng-og2cCy/angular-errors.log” for further details. npm ERR! code ELIFECYCLE npm ERR! syscall spawn npm ERR! file sh npm ERR! errno ENOENT npm ERR! safesante-ysera-front@0.0.9 build:ssr:
ng build --configuration=production && ng run safesante-ysera-front:server --configuration=production && npm run pack
npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the safesante-ysera-front@0.0.9 build:ssr script. npm ERR! This is probably not a problem with npm. There is likely additional logging output abov
and:
- cat /tmp/*/angular-errors.log [error] TypeError: Cannot read property ‘Workspace’ of undefined at Object.getWorkspace (/opt/atlassian/pipelines/agent/build/node_modules/@angular/cli/utilities/config.js:66:57) at BuildCommand.validateScope (/opt/atlassian/pipelines/agent/build/node_modules/@angular/cli/models/command.js:97:67) at BuildCommand.validateAndRun (/opt/atlassian/pipelines/agent/build/node_modules/@angular/cli/models/command.js:122:24) at Object.runCommand (/opt/atlassian/pipelines/agent/build/node_modules/@angular/cli/models/command-runner.js:201:38) at process._tickCallback (internal/process/next_tick.js:68:7) at Function.Module.runMain (internal/modules/cjs/loader.js:834:11) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
🌍 Your Environment
Docker image: teracy/angular-cli
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
Many thanks, after taking into account the above remarks, the pipeline is now working. You are awesome guys
Note: to update universal packages please use the below command.