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

Deleteing node_modules causes "You seem to not be depending on "@angular/core"." #6504

Closed
EekoS opened this issue May 30, 2017 · 16 comments
Closed

Comments

@EekoS
Copy link

EekoS commented May 30, 2017

- [x] feature request
ng -v
@angular/cli: 1.0.6
node: 6.10.3
os: win32 x64
@angular/common: error
@angular/compiler: error
@angular/core: error
@angular/forms: error
@angular/http: error
@angular/platform-browser: error
@angular/platform-browser-dynamic: error
@angular/router: error
@angular/cli: error
@angular/compiler-cli: error

Repro steps.

  1. install npm
  2. yarn global add @angular/[email protected] or npm install -g @angular/[email protected] (both produce the same)
  3. ng new myproj
  4. ng serve - works
  5. check-in to your source-control all the project files except for node_modules directory
    5.1. one can simply run move node_modules node_modules2 instead of steps 5+6
  6. go to a different computer and run steps 1+2. then, fetch the project from the source-control.
  7. ng b -> produces: You seem to not be depending on "@angular/core". This is an error.
    ng serve -> produces:
The "@angular/compiler-cli" package was not properly installed.
Error: The "@angular/compiler-cli" package was not properly installed.

Only yarn add or npm install will resolve this, which is somewhat unexpected (I am in the Angular CLI realm now, trying to build, why won't it solve my dependencies itself?)

Desired functionality.

I expected the angular-cli to successfully build the project and download all the dependencies.

@sumitarora
Copy link
Contributor

@EekoS It's the desired behavior you must install the node modules before you run the project. It's not specific to @angular dependencies as there might be other dependencies needs to be resolved before running the project.

@shabbir-dhangot
Copy link

shabbir-dhangot commented May 30, 2017

facing same issue. Any solution for these.

Even npm install not installing anything.

 
ng --version
    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.0.3
node: 7.6.0
os: linux x64
@angular/common: error
@angular/compiler: error
@angular/core: error
@angular/forms: error
@angular/http: error
@angular/platform-browser: error
@angular/platform-browser-dynamic: error
@angular/router: error
@angular/cli: error
@angular/compiler-cli: error

@shabbir-dhangot
Copy link

@EekoS For current workaround I change version to 0.0.0 and it working fine. This may be a bug.

@sumitarora
Copy link
Contributor

sumitarora commented May 31, 2017

@shabbir-dhangot @EekoS Is there a repo I can check?

@EekoS
Copy link
Author

EekoS commented Jun 5, 2017

Thank you for the reply, @sumitarora, I humbly don't see a reason why won't angular-cli simply call the package-builder (npm / yarn) to resolve dependencies when running ng build; but at least is it possible to write a more informative error?
There's no problem with angular's global installation (as it says in my step 7 to reproduce) - so the error should not say that there is IMHO.

@sumitarora
Copy link
Contributor

sumitarora commented Jun 6, 2017

@EekoS we have error already in the commands itself. Running ng b without node_modules shows this error node_modules appears empty, you may need to run npm install

@EekoS
Copy link
Author

EekoS commented Jun 6, 2017

nope, that's not what I get. see the original post...

@kleuthold
Copy link

I ran into this same issue deploying an app using ng-cli to Heroku. On the Heroku deploy, I was getting the You seem to not be depending on "@angular/core". message on ng build, which was very confusing, because it was right there in my package.json file. I'm glad I found this issue and was able to apply the workaround of making sure npm install was run before ng build. But, a more informative error message would be very helpful...

@kleuthold
Copy link

@sumitarora: like you, when I rename my node_modules directory and run ng build, I get the correct error message: node_modules appears empty, you may need to run npm install. But when I deploy to heroku, and the node_modules directory is empty, for some reason I'm getting the misleading message You seem to not be depending on "@angular/core". instead. I've tried to figure out what the difference is, but I'm unable to. Sorry, I realize that's not extremely helpful...

@silviosoto
Copy link

lo solucione con:
-> npm link
-> ng serve
y listo

@ghost
Copy link

ghost commented Nov 21, 2017

npm link fixed mine. windows 10 here. latest angular cli as of now.

@sdudhankar
Copy link

npm link
Helps to solve my problem.

@PranjaliDeshmukh
Copy link

solution:
->npm install
->ng serve

@Muhammad-Altabba
Copy link

It seems to be related to renaming the folder. The error message is misleading.
I posted the issue and the fix here
However, it is still an issue in angular since it does not show a meaningful related message.

@alan-agius4
Copy link
Collaborator

Thanks for reporting this issue. In the latest CLI the error message should be more clear

Could not find module "<foo>" from "<path>".

Please update to the most recent Angular CLI version. If the problem persists, please file a new issue and ensure you provide all of the required information when filling out the issue template.

@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 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants