“You seem to not be depending on ”@angular/core“.”

后端 未结 10 1547
执念已碎
执念已碎 2020-12-24 11:05

When I try to build my project running the following command:

ng build --environment=prod --aot=false  --output-pa         


        
相关标签:
10条回答
  • 2020-12-24 11:09

    Faced the same issue and solved by executing the npm link command.

    When we run npm link in a module’s root directory, npm creates a symbolic link from our “global node_modules” directory to the local module’s directory

    The “global node_modules” directory is a special directory where all modules installed with npm install -g are stored. We can find the path to our global node_modules directory by running npm root -g

    Visit :- https://medium.com/@alexishevia/the-magic-behind-npm-link-d94dcb3a81af

    0 讨论(0)
  • 2020-12-24 11:10

    I went down the list of installing the various dependencies as prompted in the terminal. I am running on Windows so I also installed windows Build Tools.

    I ran ng serve and got "You seem to not be depending on "@angular/core" and/or "rxjs". This is an error."

    Then ran

    npm link
    

    followed by

    ng serve
    

    Everything is now running. Not sure how much of what I did was necessary/redundant but I can now build Angular projects.

    0 讨论(0)
  • 2020-12-24 11:10

    @Sunil Kumar Sahu is correct.

    Using "ng link" means it connects your current application to your root/parent application that you have on your machine. When you run your application, any changes you make to the dependency will be reflected in the application.

    After this, just run "ng serve".

    Link : https://codurance.com/2016/12/21/how-to-use-npm-link/

    • Prakhar
    0 讨论(0)
  • 2020-12-24 11:22

    Stupid fix

    Removing node_modules and installing the packages again npm i or yarn worked for me!

    0 讨论(0)
  • 2020-12-24 11:23

    How to use

    Run npm install inside this project folder to install all dependencies.

    Make sure you use the latest version of the CLI (upgrade guide below)

    Run ng serve to see the app in action (try npm start in case ng serve fails).

    How to upgrade the CLI

    Run the below commands - only use "sudo" on Mac/ Linux.

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

    In case it fails

    Delete node_modules folder and package-lock.json file from your project directory Run the below commands in the given order-

    npm install
    
    npm install --save-dev @angular-devkit/build-angular
    
    npm link
    
    0 讨论(0)
  • 2020-12-24 11:23

    check if you have node_modules folder on project folder.

    0 讨论(0)
提交回复
热议问题