Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is "undefined".
Bug Report or Feature Request (mark with an x)
- [x] bug report -> please search issues before submitting
- [ ] feature request
Versions.
angular-cli: 1.0.0-beta.28.3 node: 6.10.0 os: darwin x64
Repro steps.
ng build
The log given by the failure.
As a forewarning, we are moving the CLI npm package to "@angular/cli" with the next release, which will only support Node 6.9 and greater. This package will be officially deprecated shortly after.
To disable this warning use "ng set --global warnings.packageDeprecation=false".
Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is "undefined".
Error: Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is "undefined".
at Object.
Desired functionality.
Our build tool cannot crash out of the blue, having changed nothing at all in our code or configurations. Running npm install with specific versions listed for every package in the package.json should not crash the build machine, and every machine of every developer unfortunate enough to have run "npm install" locally.
Mention any other details that might be useful.
Same issue
versions: angular-cli: 1.0.0-rc.0 node: 6.6.0 os: ubuntu 16.04
message:
Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is "undefined".
Error: Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is "undefined".
at Object.
I encountered the same issue
Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is "undefined".
Error: Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is "undefined".
at Object.
The project needs a dev dependency for @angular/compiler-cli.
npm install --save-dev @angular/compiler-cli@<your angular version>
Thank you @clydin That was correct. I migrated angular-cli from beta to rc.0 and this step was not part of the steps.
any update? i am facing the same issues.
any update ? i also have the same issues
yes, follow @clydin 's response...
but right now i am using angular-cli v1.0.0-beta.17, and i found that the @ngtools/webpack requires 2.3.1. i have tried to upgrade the cli to a higher version, it will throw plenty of exceptions. i just wanna stick with the ready to build version, rather than upgrade all the version.
here is my package.json
{
"name": "olt-storefront-ng2",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve --host 0.0.0.0",
"prod": "ng serve --prod",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor",
"dist": "ng build --prod && export DATE=`date +%s` && mv dist/inline.js dist/inline.$DATE.js && sed -i.bak \"s/inline\\.js/inline\\.$DATE\\.js/g\" dist/index.html"
},
"private": true,
"dependencies": {
"@angular/common": "~2.0.0",
"@angular/compiler": "~2.0.0",
"@angular/core": "~2.0.0",
"@angular/forms": "~2.0.0",
"@angular/http": "~2.0.0",
"@angular/platform-browser": "~2.0.0",
"@angular/platform-browser-dynamic": "~2.0.0",
"@angular/router": "~3.0.0",
"angular-cli": "1.0.0-beta.17",
"angular-pipes": "5.5.2",
"angular2-uuid": "1.1.0",
"core-js": "^2.4.1",
"intl": "^1.2.5",
"moment": "^2.16.0",
"ng2-meta": "2.0.2",
"ng2-page-scroll": "^4.0.0-beta.4",
"ng2-pipes": "0.4.16",
"ng2-responsive": "0.6.4",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "^1.1.1",
"zone.js": "^0.6.23",
"dompurify": "^0.8.5"
}
}
the root problem is 1.0.0-beta.17 angular-cli using "@ngtools/webpack": "latest", and which the latest is not compatible to the "angular-cli": "1.0.0-beta.17", please fix!
Same for 1.0.0-beta.18. A compiler-cli dev dependency (our angular version is 2.1.1) as suggested by @clydin does not work.
Can confirm that @clydin's method seems to require a whole bunch of other peer dependancy changes when using 2.1.0
my problem is in this file https://github.com/angular/angular-cli/blob/v1.0.0-beta.17/packages/angular-cli/package.json
how can the @ngtools/webpack using latest?
npm install --save-dev @ngtools/[email protected]
Horrible hack but at least gets it working short of upgrading all your other packages.
@aeacusvol that worked for me, thanks!
Unfortunately, the fix I suggested can only solve the case of the undefined version.
For those using beta versions, it is strongly recommended to upgrade to the latest RC. Due to the inherent nature of beta versions, active support of past beta versions is not currently viable. There is also an extensive list of bug fixes and feature improvements since the early betas.
For those interested in upgrading, there is a guide detailing the necessary steps which can be found here: https://github.com/angular/angular-cli/wiki/stories-rc-update If while following the guide any deficiencies are encountered, please open an issue so that the guide can be as complete and straightforward as possible.
@aeacusvol's solution no good on [email protected] for me at least
@mildfuzz are you building with global installation of cli? You might need to npm install -g @ngtools/[email protected] in that case
@clydin actually your solution doesn't work for me, since i am doing clean CI build every time, once your dependency is broken all the CI build will be broken. so please help to correct this issue.
@clydin your recommended fix (adding a dev dependency for @angular/compiler-cli) makes no difference in the result for me:
"dependencies": {
"@angular/common": "2.1.2",
"@angular/compiler": "2.1.2",
"@angular/core": "2.1.2",
"@angular/forms": "2.1.2",
"@angular/http": "2.1.2",
"@angular/platform-browser": "2.1.2",
"@angular/platform-browser-dynamic": "2.1.2",
"@angular/router": "3.1.2",
. . .
},
"devDependencies": {
"@angular/compiler-cli": "2.1.2",
. . .
}
> ng serve --environment=local
Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is "undefined".
Error: Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is "undefined".
Open to other suggestions. I am on a beta version of the CLI (18 to be precise), and if upgrading to the latest CLI, which seems also to require updating a whole bunch of angular dependencies is the only way to fix this, then I am going to be very unhappy. Half dozen separate but dependent projects all have to be coordinated with the version updates, and inevitable issues that go along with those. Darn good thing I didn't try this before my big demo yesterday. :/
I agree with the earlier sentiment expressed that this must be a repeatable process. If it worked a week ago (which it did), it should work today (which it doesn't), especially when there were no dependency changes in between. I'm not sure how it's even possible to make it fail like this, unless the npm versioning system means absolutely nothing.