IT박스

“@ angular / core”에 의존하지 않는 것 같습니다.

itboxs 2020. 6. 29. 08:16
반응형

“@ angular / core”에 의존하지 않는 것 같습니다. 이것은 오류입니다


각도 cli로 각도 2 앱을 만들고 싶습니다.

나는 cmd에 썼다 :

npm angular-cli -g 설치

그때:

ng firstngapp

하지만 npm start를 쓸 때 오류가 표시됩니다! 오류 이미지

파일 이미지

나는 문제를 이해하지 못한다


실행하려고

npm install

프로젝트 폴더에서


실행하는 동안 ng serve app / project 's directory에 있어야합니다 .

다른 디렉토리에서 명령을 실행하면 오류가 발생합니다.

"@ angular / core"에 의존하지 않는 것 같습니다. 이것은 오류입니다.


노드 모듈을 삭제하고 package.json파일이 있는지 @angular/core확인한 후 다시 설치합니다 npm i.


  1. node_modules 폴더 및 package-lock.json 파일을 삭제 하십시오.
  2. 그런 다음 다음 명령을 실행하면 npm 패키지가 업데이트됩니다.

    npm update

  3. 나중에 다음 명령을 실행하여 프로젝트를 시작하십시오.

    ng serve

위의 단계는 나를 위해 일했습니다.


터미널에서

 > cd myProjectPath
 myProjectPath > npm install

당신을 도울 수 있습니다.

  • 이전에 생성 한 모든 폴더 삭제
  • 새 폴더 만들기
  • 그런 다음 "cd foldername"명령에서 해당 폴더로 이동하십시오.
  • 그런 다음 "npm install"을 설치하십시오.

이렇게하면 문제가 해결됩니다.


여전히 문제인지 모르겠습니다. 나는와 같은 성가신 경험하고 있었다 @angular/cli v1.1.2의를 npm 4.1.2. node_modules디렉토리를 삭제 한 다음 업데이트를 진행했습니다 npm(이것은 과거의 일반적인 원인이므로).

(최신) 으로 업그레이드 npm하고 싶었지만 5.0.3사용 nvm하고 있었 으므로 라이브러리를 엉망으로 한 것 같습니다. 따라서 다시 설치했습니다 node.

그런 다음 나는 함께 갔다

  • npm cache clean
  • npm rebuild
  • npm install -여러 번 다른 패키지에서 오류가 발생했기 때문에 여러 번

결국 모든 패키지는 훌륭했습니다.

도움이 되었기를 바랍니다.


나를위한 해결책은

npm link
ng build 

여기에 이미지 설명을 입력하십시오


사람이 2018이로 실행중인 경우, 마지막으로 나를 위해 일한 것은 내가 만든 내 - 응용 프로그램으로 이동했다 ng new my-app, 다음 실행 ng serve이 그것을에있는 종속성과 devDependencies 필요과 관련이있다 my-app/package.json대신을 root/package.json. 두 개의 별도 파일입니다.

모든 종속성을 루트 폴더에 복사하더라도 package.json구성 파일의 경로 위치를 수동으로 변경해야합니다 my-app/*. 모든 것이 제대로 작동하도록하기 위해 들어가서 my-app/실행 하는 것이 훨씬 쉽습니다 ng serve.

따라서이 단계는 누구에게나 효과적입니다.

rm -rf <previous-app> // 이전 앱이 무엇이든 호출 한 경우

sudo rm -rf node_modules

rm -f package-lock.json

npm install

ng new my-app

cd my-app

ng serve


Run the npm update after installing all peer dependencies and it will work.


Faced the same Issue. While running ngserve you should be in the apps directory. To confirm(on GIT BASH : you will have (master) after the directory path at gitbash prompt, if you are at app directory.)


This is how I solved this problem.

I first ran npm install @angular/core.

Then I ran npm install --save.

When both installs had successfully completed I ran npm serve and received an error saying

"Versions of @angular/compiler-cli and typescript could not be determined.
The most common reason for this is a broken npm install.

Please make sure your package.json contains both @angular/compiler-cli and typescript in
devDependencies, then delete node_modules and package-lock.json (if you have one) and
run npm install again."

I then deleted my node_modules folder as well as my package-lock.json folder.

After I deleted those folders I ran npm install --save once more.

I ran npm start and received another error. This error said Error: Cannot find module '@angular-devkit/core'.

I ran npm install @angular-devkit/core --save.

Finally, I ran npm start and the project started!


I got the same issue, and the reason is

  1. when you run ng new app-name it will create a new directory with app name and install everything in that.
  2. after running the above command, human tendency is to run ng serve and because your app is in sub directory it will not find package.json and throw the mentioned error.

Solution is pretty simple. just move to the sub directory and then run ng serve


Below steps worked for me:

1) Delete the node_modules/ folder and package-lock.json file.

2) npm install

3) ng serve


You create new project with:

ng new firstngapp

In your example you are missing new. This would create folder, generate files and run npm install for you. It seems that you've created folder but there's no Angular CLI app in it.

And for starting the app use:

ng serve

npm start is only used if you have ejected from cli.


After trying to no avail:

  • npm install
  • npm update
  • ng serve

npm install -g @angular/cli worked for me


I had the same issue and along with removing the node_modules and reinstalling I needed to remove package-lock.json first.


I was getting the same error when I tried to run "ng serve" after that I saw some suggetions one of the techie told me to update my npm.I did that as well then I got this screen after entering "ng server"

""Versions of @angular/compiler-cli and typescript could not be determined. The most common reason for this is a broken npm install. Please make sure your package.json contains both @angular/compiler-cli and typescript in devDependencies, then delete node_module and package-lock.json(if you have one) and Run npm install again.""

After performing all the actions now its working correctly...and getting message "Compiled Successfully."


You need to run the ng server from the c:\project\angular-src location. Not just the root of your project.


Executing ng new --skip-install PROJECT_NAME and then manually going into the created folder and typing npm install. https://github.com/angular/angular-cli/issues/3906


In my case the following worked:

rm -rf node_modules
rm package-lock.json
npm install

Hence the npm install, not update.


The problem I had was that I followed the cli's advice to switch to yarn package management.

Then while following a tutorial I did npm install --save bootstrap, and after that point the error started appearing. Afterwards I did yarn add xxx of course and it worked.

To restore the project's state I removed node_modules and package-lock.json as per this answer and then run yarn install


Versions of @angular/compiler-cli and typescript could not be determined. The most common reason for this is a broken npm install.

Please make sure your package.json contains both @angular/compiler-cli and typescript in devDependencies, then delete node_modules and package-lock.json (if you have one) and run npm install again.


This happened to me when I was mixing package managers. My project was generated with Yarn, and after that, I added a couple of dependencies using npm install (this created the package-lock.json with only added dependencies).

분명히 ng는 사용 된 package-lock.json을 제공하고 거기에서 각도 의존성을 찾을 수 없습니다. 원사, 즉 npm 설치 대신 원사 추가 만 사용하기 시작한 후에 오류가 사라졌습니다.


** ng serve 명령을 누르기 전에 새로 작성된 YOUR_APP 폴더에 있어야합니다. **

신선한 것부터 시작합시다

1) install npm

2) 새로운 각도 앱 만들기 ( ng new <YOUR_APP_NAME>)

3) 앱 폴더로 이동합니다 ( cd YOUR_APP_NAME)

4) ng serve

문제가 해결되기를 바랍니다.


이 문제를 해결하려면

  1. 1 단계: cd projectName
  2. 2 단계: npm update
  3. 3 단계 : ng serve -o

예를 들면 다음과 같습니다. 여기에 이미지 설명을 입력하십시오


ng serve의 경우 해당 디렉토리 안에 있어야합니다.

ashish@ashish-Inspiron-3521:~/Angular$ ng new FireStore
  create FireStore/README.md (1025 bytes)
  create FireStore/.angular-cli.json (1245 bytes)
  create FireStore/.editorconfig (245 bytes)
  create FireStore/.gitignore (544 bytes)
  create FireStore/src/assets/.gitkeep (0 bytes)
  create FireStore/src/environments/environment.prod.ts (51 bytes)
  create FireStore/src/environments/environment.ts (387 bytes)
  create FireStore/src/favicon.ico (5430 bytes)
  create FireStore/src/index.html (296 bytes)
  create FireStore/src/main.ts (370 bytes)
  create FireStore/src/polyfills.ts (3114 bytes)
  create FireStore/src/styles.css (80 bytes)

ashish@ashish-Inspiron-3521:~/Angular$ ng serve
You seem to not be depending on "@angular/core". This is an error.

cmd를 사용하여 이것을 해결하는 방법

ashish@ashish-Inspiron-3521:~/Angular$ cd FireStore/

이제 cmd를 수행하십시오.

ashish@ashish-Inspiron-3521:~/Angular/FireStore$ ng serve
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **

참고 URL : https://stackoverflow.com/questions/41534459/you-seem-to-not-be-depending-on-angular-core-this-is-an-error

반응형