angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

npm install -g @angular/cli not work

Open michaelcmundo opened this issue 8 years ago • 6 comments

I have issues with ng serve as it returns the following..

Cannot find module '@angular/compiler-cli' Error: Cannot find module '@angular/compiler-cli'....

Then when I do ng version it returns these: Package Version @angular-devkit/architect 0.10.6 (cli-only) @angular-devkit/build-angular @angular-devkit/core 7.0.6 (cli-only) @angular-devkit/schematics 7.0.6 (cli-only) @angular/cli @angular/compiler-cli @angular/language-service @schematics/angular 7.0.6 (cli-only) @schematics/update 0.10.6 (cli-only) rxjs 6.3.3 typescript 3.1.6 (cli-only)

But my package.json seems do have those: { "name": "testapp", "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/animations": "~7.0.0", "@angular/common": "~7.0.0", "@angular/compiler": "~7.0.0", "@angular/core": "~7.0.0", "@angular/forms": "~7.0.0", "@angular/http": "~7.0.0", "@angular/platform-browser": "~7.0.0", "@angular/platform-browser-dynamic": "~7.0.0", "@angular/router": "~7.0.0", "core-js": "^2.5.4", "rxjs": "~6.3.3", "zone.js": "~0.8.26" }, "devDependencies": { "@angular-devkit/build-angular": "~0.10.0", "@angular/cli": "~7.0.6", "@angular/compiler-cli": "~7.0.0", "@angular/language-service": "~7.0.0", "@types/node": "~8.9.4", "@types/jasmine": "~2.8.8", "@types/jasminewd2": "~2.0.3", "codelyzer": "~4.5.0", "jasmine-core": "~2.99.1", "jasmine-spec-reporter": "~4.2.1", "karma": "~3.0.0", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "~2.0.1", "karma-jasmine": "~1.1.2", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.4.0", "ts-node": "~7.0.0", "tslint": "~5.11.0", "typescript": "~3.1.6" } }

I tried removing package-lock.json and npm install but didn't help. Any idea why those packages have with the version command?

Here's the result for npm install: \testapp> npm install npm WARN deprecated [email protected]: CircularJSON is in maintenance only, flatted is its successor. npm notice created a lockfile as package-lock.json. You should commit this file. audited 39133 packages in 9.165s found 0 vulnerabilities

Addition notes: npm -v (6.4.1) & node -v (v10.13.0)

michaelcmundo avatar Nov 23 '18 16:11 michaelcmundo

Hi,

  1. can you provide the full error?

  2. can you run npm ls @angular/compiler-cli and paste the out put here?

  3. when you removed the package lock, did you remove the entire node_modules aswell? If not try that

Thanks.

alan-agius4 avatar Nov 23 '18 17:11 alan-agius4

What is npm le? Did you mean one of these? ls se ln

Also tried removing node_modules as well and still the same.

michaelcmundo avatar Nov 23 '18 18:11 michaelcmundo

PS C:\Users\michael\angular> npm install -g @angular/compiler-cli C:\Users\michael\AppData\Roaming\npm\ivy-ngcc -> C:\Users\michael\AppData\Roaming\npm\node_modules@angular\compiler-cli\src\ngcc\main-ngcc.js C:\Users\michael\AppData\Roaming\npm\ng-xi18n -> C:\Users\michael\AppData\Roaming\npm\node_modules@angular\compiler-cli\src\extract_i18n.js C:\Users\michael\AppData\Roaming\npm\ngc -> C:\Users\michael\AppData\Roaming\npm\node_modules@angular\compiler-cli\src\main.js npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none is installed. You must install peer dependencies yourself. npm WARN @angular/[email protected] requires a peer of typescript@>=3.1.1 <3.2 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules@angular\compiler-cli\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

michaelcmundo avatar Nov 23 '18 18:11 michaelcmundo

I did a few things on npm install and now I got his error. This is so frustrating. I would expect running the commands to work.

ERROR in ./src/main.ts Module build failed (from ./node_modules/@ngtools/webpack/src/index.js): Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15) at Function.Module._load (internal/modules/cjs/loader.js:506:25) at Module.require (internal/modules/cjs/loader.js:636:17) at require (internal/modules/cjs/helpers.js:20:18) at Object. (C:\Users\michael.cheung\angular\test7\node_modules@ngtools\webpack\src\resource_loader.js:16:28) at Module._compile (internal/modules/cjs/loader.js:688:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10) at Module.load (internal/modules/cjs/loader.js:598:32) at tryModuleLoad (internal/modules/cjs/loader.js:537:12) at Function.Module._load (internal/modules/cjs/loader.js:529:3)

at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (C:\Users\michael.cheung\angular\test7\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:23:27)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)

ERROR in ./src/polyfills.ts Module build failed (from ./node_modules/@ngtools/webpack/src/index.js): Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15) at Function.Module._load (internal/modules/cjs/loader.js:506:25) at Module.require (internal/modules/cjs/loader.js:636:17) at require (internal/modules/cjs/helpers.js:20:18) at Object. (C:\Users\michael.cheung\angular\test7\node_modules@ngtools\webpack\src\resource_loader.js:16:28) at Module._compile (internal/modules/cjs/loader.js:688:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10) at Module.load (internal/modules/cjs/loader.js:598:32) at tryModuleLoad (internal/modules/cjs/loader.js:537:12) at Function.Module._load (internal/modules/cjs/loader.js:529:3) at Module.require (internal/modules/cjs/loader.js:636:17) at require (internal/modules/cjs/helpers.js:20:18) at Object. (C:\Users\michael.cheung\angular\test7\node_modules@ngtools\webpack\src\angular_compiler_plugin.js:23:27) at Module._compile (internal/modules/cjs/loader.js:688:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10) at Module.load (internal/modules/cjs/loader.js:598:32)

I also tried posting question from stackoverflow as that's what webpack suggested. But I mean the angular-cli depends on that when doing ng serve. So this should be look at in this end as well?

This is really bad when you post those command and just doesn't work. Hope anyone can resolve these.

michaelcmundo avatar Nov 23 '18 21:11 michaelcmundo

Hello, we reviewed this issue and determined that it doesn't fall into the bug report or feature request category. This issue tracker is not suitable for support requests, please repost your issue on StackOverflow using tag angular-cli.

If you are wondering why we don't resolve support issues via the issue tracker, please check out this explanation.

alan-agius4 avatar Nov 26 '18 08:11 alan-agius4

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.