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.
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
Here is the angular-cli Git Page details:
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.
- npm uninstall -g angular-cli (getting rid of global instance as we won't be shirnkwrapping that).
- npm cache clean (at this point I'm assuming you currently have your desired version of angular-cli installed in your project's node_modules)
- Delete the 'webpack' folder from
\node_modules@ngtools and replace it with a version that you know works (in my case this was 1.1.4) - Manually edit
\node_modules\angular-cli\package.json and change the dependency from "@ngtools/webpack": "latest"to"@ngtools/webpack": "1.1.4"(bear with me - this is only temporary) - npm shrinkwrap
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 [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>