Angular CLI Project Missing Module Errors After Git Pull

Viewed 1856

I'm using Angular4 with Angular/CLI 1.2.1. I'm able to initialize fine and use ng serve to run the application locally. However, after pushing to a remote git repo and then doing pulling my work down on a different machine - I get errors.

Steps to Recreate
1. Pull project created using Angular CLI from remote git repo.
2. NPM install.
3. ng serve.

Error Messages

ERROR in D:/application/src/app/app.component.ts (1,27): Cannot find module '@angular/core'.

ERROR in D:/application/src/app/app.component.ts (8,14): Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.

ERROR in D:/application/src/app/app.module.ts (1,31): Cannot find module '@angular/platform-browser'.

ERROR in D:/application/src/app/app.module.ts (2,26): Cannot find module '@angular/core'.

ERROR in D:/application/src/app/app.module.ts (16,14): Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.

ERROR in D:/application/src/main.ts (1,32): Cannot find module '@angular/core'.

ERROR in D:/application/src/main.ts (2,40): Cannot find module '@angular/platform-browser-dynamic'.

ERROR in Could not resolve module @angular/core

ERROR in D:/application/src/main.ts (1,32): Cannot find module '@angular/core'.

ERROR in D:/application/src/main.ts (2,40): Cannot find module '@angular/platform-browser-dynamic'.

ERROR in D:/application/src/app/app.module.ts (1,31): Cannot find module '@angular/platform-browser'.

ERROR in D:/application/src/app/app.module.ts (2,26): Cannot find module '@angular/core'.

ERROR in D:/application/src/app/app.module.ts (16,14): Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.

ERROR in D:/application/src/app/app.component.ts (1,27): Cannot find module '@angular/core'.

ERROR in D:/application/src/app/app.component.ts (8,14): Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.

webpack: Failed to compile.

NPM Install Output

npm WARN prefer global node-gyp@3.6.2 should be installed with -g

node-sass@4.5.3 install D:\application\node_modules\node-sass node scripts/install.js

Cached binary found at C:\Users\user\AppData\Roaming\npm-cache\node-sass\4.5.3\win32-x64-48_binding.node

node-sass@4.5.3 postinstall D:\application\node_modules\node-sass node scripts/build.js

Binary found at D:\application\node_modules\node-sass\vendor\win32-x64-48\binding.node Testing binary Binary is fine

...proceeds to install without error (including @angular/core and other packages).

3 Answers

Easy way to remove node_modules folder from your angular project hierarchy and use to re install all the packages by using npm install

try Deleting package-lock.json file and then install node_modules npm install

Related