angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is "undefined".

Open ghost opened this issue 9 years ago • 43 comments

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. (.../node_modules/@ngtools/webpack/src/index.js:27:11) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) ... etc ...

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.

ghost avatar Mar 22 '17 00:03 ghost

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. (/.../.../.../node_modules/@angular/cli/node_modules/@ngtools/webpack/src/index.js:27:11) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object. (/.../.../.../node_modules/@angular/cli/tasks/eject.js:10:19) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19)

manatax avatar Mar 22 '17 01:03 manatax

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. (/home/rxjs/work/ng2-tdd/angular-tdd/node_modules/@ngtools/webpack/src/index.js:27:11) at Module._compile (module.js:571:32) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at Object. (/home/rxjs/work/ng2-tdd/angular-tdd/node_modules/angular-cli/models/webpack-build-typescript.js:5:17) at Module._compile (module.js:571:32) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at Object. (/home/rxjs/work/ng2-tdd/angular-tdd/node_modules/angular-cli/models/webpack-config.js:2:34) at Module._compile (module.js:571:32) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at Object. (/home/rxjs/work/ng2-tdd/angular-tdd/node_modules/angular-cli/tasks/build-webpack.js:6:24) at Module._compile (module.js:571:32) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at Object. (/home/rxjs/work/ng2-tdd/angular-tdd/node_modules/angular-cli/commands/build.js:3:23) at Module._compile (module.js:571:32) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at Class.includedCommands (/home/rxjs/work/ng2-tdd/angular-tdd/node_modules/angular-cli/addon/index.js:21:16) at /home/rxjs/work/ng2-tdd/angular-tdd/node_modules/angular-cli/angular-cli/lib/models/project.js:392:61 at Array.forEach (native) at Project.addonCommands (/home/rxjs/work/ng2-tdd/angular-tdd/node_modules/angular-cli/angular-cli/lib/models/project.js:391:15) at Project.eachAddonCommand (/home/rxjs/work/ng2-tdd/angular-tdd/node_modules/angular-cli/angular-cli/lib/models/project.js:426:30) at module.exports (/home/rxjs/work/ng2-tdd/angular-tdd/node_modules/angular-cli/angular-cli/lib/cli/lookup-command.js:33:13) at CLI. (/home/rxjs/work/ng2-tdd/angular-tdd/node_modules/angular-cli/angular-cli/lib/cli/cli.js:34:26) at tryCatch (/home/rxjs/work/ng2-tdd/angular-tdd/node_modules/rsvp/dist/rsvp.js:539:12) at invokeCallback (/home/rxjs/work/ng2-tdd/angular-tdd/node_modules/rsvp/dist/rsvp.js:554:13) at publish (/home/rxjs/work/ng2-tdd/angular-tdd/node_modules/rsvp/dist/rsvp.js:522:7) at flush (/home/rxjs/work/ng2-tdd/angular-tdd/node_modules/rsvp/dist/rsvp.js:2414:5) at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickCallback (internal/process/next_tick.js:98:9)

khaledbouguerra avatar Mar 22 '17 01:03 khaledbouguerra

The project needs a dev dependency for @angular/compiler-cli. npm install --save-dev @angular/compiler-cli@<your angular version>

clydin avatar Mar 22 '17 01:03 clydin

Thank you @clydin That was correct. I migrated angular-cli from beta to rc.0 and this step was not part of the steps.

manatax avatar Mar 22 '17 01:03 manatax

any update? i am facing the same issues.

cycchow avatar Mar 22 '17 07:03 cycchow

any update ? i also have the same issues

glorment avatar Mar 22 '17 07:03 glorment

yes, follow @clydin 's response...

manatax avatar Mar 22 '17 07:03 manatax

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.

cycchow avatar Mar 22 '17 07:03 cycchow

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"
		  }
		}

cycchow avatar Mar 22 '17 08:03 cycchow

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!

cycchow avatar Mar 22 '17 08:03 cycchow

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.

jfranken avatar Mar 22 '17 12:03 jfranken

Can confirm that @clydin's method seems to require a whole bunch of other peer dependancy changes when using 2.1.0

mildfuzz avatar Mar 22 '17 12:03 mildfuzz

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?

cycchow avatar Mar 22 '17 12:03 cycchow

npm install --save-dev @ngtools/[email protected] Horrible hack but at least gets it working short of upgrading all your other packages.

aeacusvol avatar Mar 22 '17 12:03 aeacusvol

@aeacusvol that worked for me, thanks!

rricamar avatar Mar 22 '17 13:03 rricamar

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.

clydin avatar Mar 22 '17 13:03 clydin

@aeacusvol's solution no good on [email protected] for me at least

mildfuzz avatar Mar 22 '17 16:03 mildfuzz

@mildfuzz are you building with global installation of cli? You might need to npm install -g @ngtools/[email protected] in that case

aeacusvol avatar Mar 22 '17 16:03 aeacusvol

@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.

cycchow avatar Mar 22 '17 17:03 cycchow

@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.

lorenjerickson avatar Mar 22 '17 18:03 lorenjerickson