Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"You have to be inside an angular-cli project in order to use the build command." due to global and local cli version being out of sync #4379

Closed
wardbell opened this issue Feb 2, 2017 · 10 comments · Fixed by #4381

Comments

@wardbell
Copy link
Contributor

wardbell commented Feb 2, 2017

note: this was filed by @IgorMinar from wards computer, so blame @IgorMinar for any pain this issue has caused to you.

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)

MacOS

Versions.

global:

$ ng version

@angular/cli: 1.0.0-beta.29
node: 6.9.5
os: darwin x64
@angular/common: 2.4.5
@angular/compiler: 2.4.5
@angular/core: 2.4.5
@angular/forms: 2.4.5
@angular/http: 2.4.5
@angular/material: 2.0.0-beta.1
@angular/platform-browser: 2.4.5
@angular/platform-browser-dynamic: 2.4.5
@angular/router: 3.4.5
@angular/compiler-cli: 2.4.5

local:

$ $(yarn bin)/ng version

angular-cli: 1.0.0-beta.28.3
node: 6.9.5
os: darwin x64
@angular/common: 2.4.5
@angular/compiler: 2.4.5
@angular/core: 2.4.5
@angular/forms: 2.4.5
@angular/http: 2.4.5
@angular/material: 2.0.0-beta.1
@angular/platform-browser: 2.4.5
@angular/platform-browser-dynamic: 2.4.5
@angular/router: 3.4.5
@angular/compiler-cli: 2.4.5

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

$ ng build
You have to be inside an angular-cli project in order to use the
 build command.

but if I do:

$ $(yarn bin)/ng build
.... works just fine ....
@wardbell
Copy link
Contributor Author

wardbell commented Feb 2, 2017

fyi, to resolve this problem we did the following:

yarn remove angular-cli
yarn add @angular/cli --dev

@beeman
Copy link
Contributor

beeman commented Feb 2, 2017

@wardbell the local package.json should be updated to have "@angular/cli": "^1.0.0-beta.29", instead of "angular-cli": "1.0.0-beta.28.3".

@victorpigmeo
Copy link

does not work here, still having the error

@beeman
Copy link
Contributor

beeman commented Feb 3, 2017

@victorblq can you remove node_modules and npm install ?

hansl added a commit to hansl/angular-cli that referenced this issue Feb 3, 2017
Check for either angular-cli or @angular/cli in the dependencies of the current project.

Fixes angular#4379
hansl added a commit that referenced this issue Feb 3, 2017
Check for either angular-cli or @angular/cli in the dependencies of the current project.

Fixes #4379
@victorpigmeo
Copy link

victorpigmeo commented Feb 3, 2017

I fix changing the package.json file this way:
from:

 "devDependencies": {
    "@angular/compiler-cli": "2.4.5",
    "angular-cli": "1.0.0-beta.26",
    ...

to:

"devDependencies": {
    "@angular/cli": "1.0.0-beta.29",
    "@angular/compiler-cli": "^2.3.1",
    ...

I removed this line too:
"lint": "tslint \"src/**/*.ts\" --project src/tsconfig.json --type-check && tslint \"e2e/**/*.ts\" --project e2e/tsconfig.json --type-check",
and the angular-cli.json like @hansl said.
After that rm -rf node_modules and npm install and ng serve works.
I don't know if it's relevant, but I did it all in a existing project, not a new one.

@beeman
Copy link
Contributor

beeman commented Feb 3, 2017

@victorblq yep, only existing packages (created by angular-cli, ran with@angular/cli are affected).

The next beta adds support for both though.

MRHarrison pushed a commit to MRHarrison/angular-cli that referenced this issue Feb 9, 2017
Check for either angular-cli or @angular/cli in the dependencies of the current project.

Fixes angular#4379
@azollai
Copy link

azollai commented Dec 7, 2017

You should run "npm install -g @angular/cli@latest". It solved for me.

@naveennavi2106
Copy link

@azollai Thanks

@ramanimukesh
Copy link

Yes this worked for me as well thanks
npm install -g @angular/cli@latest

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants