0
votes

I have installed angular cli 1.5 from the command below:

C:\ANGULAR-WORKBENCH>npm install --global @angular/[email protected]

after completion of installation the following lines were displayed on terminal

+ @angular/[email protected]
added 115 packages and updated 1 package in 105.694s

Then I have tested if it was successfully installed by

C:\ANGULAR-WORKBENCH>ng -version

or

C:\ANGULAR-WORKBENCH>ng

In Both cases it displayed the error

module.js:538 throw err; ^
Error: Cannot find module '@angular-devkit/core' at Function.Module._resolveFilename (module.js:536:15) at Function.Module._load (module.js:466:25) at Module.require (module.js:579:17) at require (internal/module.js:11:18) at Object. (C:\Users\User1\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\src\tree\virtual.js:10:16) at Module._compile (module.js:635:30) at Object.Module._extensions..js (module.js:646:10) at Module.load (module.js:554:32) at tryModuleLoad (module.js:497:12) at Function.Module._load (module.js:489:3)

Why this throws the error? How do i fix this issue?

3
This isn't something SO can help with, it's a known issue in a third party library.jonrsharpe
Is version 1.5.0 a must for you? Otherwise I would take the @latest. I had the same problem as you with a newer version of the cli and by installing the latest version globally and locally the problem was solved.zgue

3 Answers

0
votes

You're using an old angular cli version. Try updating it:

$ npm install -g @angular/cli@^1.6.5 
1
votes

Perhaps the problem is that you are installing and old angular/cli version, try running this commands in your terminal:

npm uninstall -g angular-cli
npm cache clean or npm cache verify #(if npm > 5)
npm install -g @angular/cli@latest

If you need more datailed explanation please check this link: https://stackoverflow.com/a/43931987/8992452, it worked for me.

0
votes

All you need to do is run npm i -D @angular-devkit/core in the working directory to fix it.