developer tip

angular-cli를 다시 설치 한 후 빌드 명령을 사용하려면 angular-cli 프로젝트 안에 있어야합니다.

optionbox 2020. 8. 6. 08:15
반응형

angular-cli를 다시 설치 한 후 빌드 명령을 사용하려면 angular-cli 프로젝트 안에 있어야합니다.


전 세계에 최신 앵귤러 클리를 설치했으며 프로젝트가 성공적으로 구축되었습니다.

다른 문제에 대한 제안 솔루션을 읽는 동안 ( https://github.com/angular/angular-cli/issues/917 ) 글로벌 angular-cli를 제거하고 dev-dependency로 설치했습니다.

다른 문제는 해결되지 않았으므로 dev-dependency를 제거하고 angular-cli를 다시 한 번 다시 설치했습니다. 이제 ng 빌드를 시도 하면 오류가 발생합니다.

build 명령을 사용하려면 angular-cli 프로젝트 안에 있어야합니다.

내 angular-cli 버전은 변경되지 않았습니다. 왜 내 프로젝트가 앵귤러 클리 프로젝트로 인식되지 않습니까?


John Pankowicz의 답변과 동일하지만 제 경우에는 달리기를해야했습니다.

npm install -g @angular/cli@latest

버전이 일치해야합니다.


알았어.

package.jsonangular-cli에 대한 종속성을 포함해야합니다 .

로컬 angular-cli를 제거하면 npm은 종속성 항목도 제거했습니다.


npm uninstall -g angular-cli @angular/cli
npm cache clean
npm install -g @angular/cli

Mac / Linux에서 sudo를 사용하십시오.


같은 오류 메시지가 나타났습니다. 그러나 원인과 해결책은 약간 다릅니다. "ng -v"를 실행하면 angular-cli (1.0.0-beta.28.3) 및 @ angular / cli (1.0.0-beta.31)에 대해 다른 버전이 표시되었습니다. 나는 다시 ran :

npm install -g @angular/cli

이제 둘 다 1.0.0-beta.31 버전을 보여줍니다. 오류 메시지가 사라지고 "ng serve"가 작동합니다. (예-다시 설치 한 것은 @ angular / cli였으며 angular-cli 버전은 업데이트되었습니다.)


내 경우에는 효과가 있었다

sudo npm uninstall -g angular-cli @angular/cli
sudo npm cache clean --force
npm install npm@latest -g
sudo npm install -g @angular/cli

사용하다 npm install angular-cli --save-dev


단계별로 다음 명령을 실행하십시오.

sudo npm uninstall -g angular-cli @angular/cli

sudo npm cache clean

npm install npm@latest -g

sudo npm install -g @angular/cli

npm rebuild node-sass --force

npm uninstall -g angular-cli
npm uninstall --save angular-cli
npm uninstall -g @angular/cli
npm uninstall --save @angular/cli
npm cache clean
npm install --save-dev @angular/cli@latest

제 경우에는 (Mac OS X 및 이전에 Angular 1.5 환경을 사용했습니다)

npm -g cache clean --force

npm cache clean --force

worked. (npm install -g @angular/cli@latest afterwards)


It works with npm install -g @angular/cli@latest for me.


This is what helped me when I found myself in the same problem:

npm uninstall -g angular-cli @angular/cli
npm cache clean --force
npm install -g @angular/cli@latest

This error comes when there's incompatibility between node version and angular/cli version. therefore use below command to update the cli version to latest

npm install -g @angular/cli@latest


npm uninstall -g angular-cli @angular/cli

npm cache clean --force

npm install -g @angular-cli/latest

I had tried similar commands and work for me but make sure you use them from the command prompt with administrator rights


I had the same issue - it turned out that i was using a deprecated angular-cli instead of @angular/cli. The latter was used by my dev team and it took me some time to notice that we were using a different versions of angular-cli.


Dont forget of to use --force:

npm cache clean --force

I had the similar problem and nothing was working out but then I Followed below Steps and It worked for me. when I ran cmd as administrator it worked fine for me.

  1. First run the Command Prompt as administrator ans.

  2. Create the new project.

If it still doesn't create the project, remove the folder and all it's files, and then run ng new <project name> followed by ng serve.

If nothing works just uninstall node and every other file related to it and follow the steps above


Just include this in the package.json in devDependencies section

"angular-cli": "1.0.0-beta.25.5"

Not compulsory to install it if you have another vresion of cli installed globally.

I got this issue when I worked with angular2 & 4 at a time with different project. So angular4 - need angular-cli@latest and angular2 need angular-cli the above version.


I faced the same issue while running my project: I found out that if your project is using specific version of any thing in package.json find out that and install the specific version of that dependencies like for me, npm install @angular/cli@^4.0.0.


npm uninstall -g angular-cli 

npm install -g @angular/cli

That's it!

enter image description here

참고URL : https://stackoverflow.com/questions/39133782/you-have-to-be-inside-an-angular-cli-project-in-order-to-use-the-build-command-a

반응형