x
)- [x] bug report -> please search issues before submitting
- [ ] feature request
angular-cli: 1.0.0-beta.28.3
node: 6.10.0
os: darwin x64
ng build
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.
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
... etc ...
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.
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.
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.
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)
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.
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.
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.
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.
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.
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.
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)
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.
Since you're on an old version of angular and a very old beta of the CLI you'll need to use @aeacusvol suggestion instead.
For beta.18 the version of @ngtools/webpack should be 1.1.2.
npm install --save-dev @ngtools/[email protected]
Also please note that these are beta versions; expect them to break.
@clydin thanks for the tip, but unfortunately that doesn't work either. Exactly the same result. I guess I've got YAAVU (Yet Another Angular Version Update) to slog through now. You understand my point about how if this worked once it should always work, right? This worked just fine a week ago. Now it doesn't. And no changes to our dependencies in between. The process has to be repeatable or the whole npm packaging and versioning system cannot be trusted.
The only way I can think of for it to break like this is if someone publishes a package with breaking changes without rev-ing the version number or bothering to say anything about it. And that someone was not me. But I'm picking up the pieces.
And to your comment about my "very old" verison of angular, let's be very precise: that was 6 months ago. Not exactly a geological age.
@aeacusvol nope, my deploy task specifically targets the version within the package modules folder:
"compile": "node node_modules/angular-cli/bin/ng build --prod"
Heya, I just want to chime in even though @clydin has already offered a number of solutions.
This issue is related to https://github.com/angular/angular-cli/pull/5118, and the fact that on older versions of the CLI the @ngtools/webpack
dependency was rather loose.
We've since fixed @ngtools/webpack
to not be as loose. The @angular/compiler-cli
dependency has also been there for a while now, and is explicitly mentioned in https://github.com/angular/angular-cli/wiki/stories-rc-update.
I'm sorry that this release wrecked havoc in older releases, and that it has caused you to have to spend time updating and fixing packages.
This isn't something that you can expect to be fixed without an update on your side though. I'm sorry but it's just not. beta.18
and beta.28.3
are versions that were never meant to be supported long term and we never tried to hide that. The only version for which there is long term support is 1.0
when it is out.
The only solution that I think can help really old versions is to force the @ngtools/webpack
version as @clydin recommended.
I'd also like to highlight this comment:
You understand my point about how if this worked once it should always work, right? This worked just fine a week ago. Now it doesn't.
I understand that this is desirable. But you do not get that guarantee out of the box with npm
. You need to either use npm shrinkwrap
or yarn
to have reproducible dependency installs.
Got my beta.21 working again thanks to @aeacusvol's solution
So how about updating angular CLI, then just starting a new app (ng new
If you're using Angular CLI beta.28 or less, you need to uninstall angular-cli package. It should be done due to changing of package's name and scope from angular-cli to @angular/cli:
npm uninstall -g angular-cli
npm uninstall --save-dev angular-cli
To update Angular CLI to a new version, you must update both the global package and your project's local package.
Global package:
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@latest
Local project package:
rm -rf node_modules dist # use rmdir /S/Q node_modules dist in Windows Command Prompt; use rm -r -fo node_modules,dist in Windows PowerShell
npm install --save-dev @angular/cli@latest
npm install
@filipesilva points all received and accepted here but it's a huge bummer when these things happen (I've come to assume they are unfortunate but inevitable when working with node + npm). While it sucks, the versions facing the issue were clearly beta
and so people need to accept the fact that they may encounter issues and not receive long term support.
npm shrinkwrap however does not help with this one due to the very loose latest
tag that was used. We use shrinkwrap with our project and the issue still occurs. Oh well, an Angular + Angular CLI upgrade was overdue for us anyways... 😉
I have a solution if you aren't ready to upgrade angular-cli or @angular/cli.
It can be done using shrinkwrap and some hoop-jumping. Even though some hackery is invloved, it does result in a fileset that can perform a fresh build from source.
"@ngtools/webpack": "latest"
to "@ngtools/webpack": "1.1.4"
(bear with me - this is only temporary)That's it, now shrinkwrap.json will contain the locked down dependenies that will work for you! From here you should be able to delete node_modules and do 'npm install' successfully.
One more thing, because we're now using a local version of 'ng', you'll need do update your 'scripts' section of package.json - replace any reference to 'ng' with 'node node_modules/angular-cli/bin/ng'
. Also as @mildfuzz points out, you might want to add a script line for compile, eg:-
"compile": "node node_modules/angular-cli/bin/ng build"
The solution @joshdanhall suggested works for me.
There are some environment settings that have to be changed as well in
I would share but I'm not at my computer!!! Sorry.
When I: ng serve, the prompt responded with the chages I needed.
But to get to that point, I just built a new app: ng new
After that, I: ng serve - after that I got the response with the environment setting changes and vwa-la!
.json *
FYI: as we're upgrading modules for RC4 compliance we temporarily tweaked the broken build to use an unzipped node_modules from a working build (luckily preserved on several dev boxes) instead of running npm install. This buys you time to keep adding/building the old code while you upgrade a new branch to use angular-cli RC4 (and beyond). Hopefully this helps somebody.
Yep, same problem here, I did similar thing as @Cogitaria, created .tbz2 from working node_modules directory on dev machine, commited it (unfortunately) and tweaked CI to unpack this archive instead of npm install
. Should give us some time before upgrading (if ever...).
Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is "undefined"
Even I am facing the same issue while installing CLI version 1.0.0-beta-20-4. Please let me know how can resolve this issue
Thanks in Advance
#Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is "undefined".
i found this issue , when i upgraded angular cli and create a new project , after run ng serve command this error occurred . please help me what can i do right now in this situation
you should have to uninstall angular cli properly then after install again
angular cli
npm install -g @angular/cli
On Wed, May 3, 2017 at 6:23 AM, Jonathan Prass Martins <
[email protected]> wrote:
Cannot install @angular/[email protected], it keeps falling to 1.0.0-beta.17
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/angular/angular-cli/issues/5558#issuecomment-298803909,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AXkePVagBZcg1_sPpx1RuNaGsumLhMkOks5r19ctgaJpZM4Mklhk
.
--
ATTA UR REHMAN
atta.[email protected]
Software Developer
I think you shoud update to angualr cli 1.0 :
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@latest
remove local project package:rm -rf node_modules dist # use rmdir on Windows
then install angular cli locally in your repo : npm install --save-dev @angular/cli@latest
finally : npm install
you should read over this for further infos: stories 1.0 update
After uninstall it type "which ng" and remove the symlink. The installation should create a new one pointed to the correct path.
I have node 6.11.0 and ubuntu 14.04 but it is not installing angular cli I am getting following error
`npm ERR! git clone --template=/home/saqlain/.npm/_git-remotes/_templates --mirror [email protected]:angular/cli.git /home/saqlain/.npm/_git-remotes/git-github-com-angular-cli-git-05516032: Cloning into bare repository '/home/saqlain/.npm/_git-remotes/git-github-com-angular-cli-git-05516032'...
npm ERR! git clone --template=/home/saqlain/.npm/_git-remotes/_templates --mirror [email protected]:angular/cli.git /home/saqlain/.npm/_git-remotes/git-github-com-angular-cli-git-05516032: Warning: Permanently added 'github.com,192.30.253.113' (RSA) to the list of known hosts.
npm ERR! git clone --template=/home/saqlain/.npm/_git-remotes/_templates --mirror [email protected]:angular/cli.git /home/saqlain/.npm/_git-remotes/git-github-com-angular-cli-git-05516032: Permission denied (publickey).
npm ERR! git clone --template=/home/saqlain/.npm/_git-remotes/_templates --mirror [email protected]:angular/cli.git /home/saqlain/.npm/_git-remotes/git-github-com-angular-cli-git-05516032: fatal: Could not read from remote repository.
npm ERR! git clone --template=/home/saqlain/.npm/_git-remotes/_templates --mirror [email protected]:angular/cli.git /home/saqlain/.npm/_git-remotes/git-github-com-angular-cli-git-05516032:
npm ERR! git clone --template=/home/saqlain/.npm/_git-remotes/_templates --mirror [email protected]:angular/cli.git /home/saqlain/.npm/_git-remotes/git-github-com-angular-cli-git-05516032: Please make sure you have the correct access rights
npm ERR! git clone --template=/home/saqlain/.npm/_git-remotes/_templates --mirror [email protected]:angular/cli.git /home/saqlain/.npm/_git-remotes/git-github-com-angular-cli-git-05516032: and the repository exists.
npm ERR! Linux 4.4.0-78-generic
npm ERR! argv "/home/saqlain/.nvm/versions/node/v6.11.0/bin/node" "/home/saqlain/.nvm/versions/node/v6.11.0/bin/npm" "install" "-g" "angular/cli"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! code 128
npm ERR! Command failed: git clone --template=/home/saqlain/.npm/_git-remotes/_templates --mirror [email protected]:angular/cli.git /home/saqlain/.npm/_git-remotes/git-github-com-angular-cli-git-05516032
npm ERR! Cloning into bare repository '/home/saqlain/.npm/_git-remotes/git-github-com-angular-cli-git-05516032'...
npm ERR! Warning: Permanently added 'github.com,192.30.253.113' (RSA) to the list of known hosts.
npm ERR! Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm ERR! Please include the following file with any support request:
`
I get this error using VS Code on Zorin Linux (Ubuntu 16.04):
It says that it needs to be 2.3.1 or higher, but doesn't accept 5.05!
Exception has occurred: CLR/System.AggregateException
An exception of type 'System.AggregateException' occurred in System.Private.CoreLib.dll but was not handled in user code: 'One or more errors occurred.'
Inner exceptions found, see $exception in variables window for more details.
Innermost exception Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException : Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is "5.0.5".
Error: Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is "5.0.5".
at Object.<anonymous>
@Alfetta159 I think this is caused by an old version of webpack: https://github.com/angular/angular-cli/issues/8806
The project needs a dev dependency for @angular/compiler-cli.
npm install --save-dev @angular/compiler-cli@<your angular version>
Hi @clydin tried that no solution
Most helpful comment
npm install --save-dev @ngtools/[email protected]
Horrible hack but at least gets it working short of upgrading all your other packages.