Momen
Momen

Reputation: 512

Error: Cannot find module '@ngtools/json-schema' on mac

On my mac i installed angular-cli with

brew install angular-cli

but when i run ng g service test i get this error:

module.js:538
    throw err;
    ^

Error: Cannot find module '@ngtools/json-schema'
    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.<anonymous> (/usr/local/lib/node_modules/@angular/cli/models/config/config.js:6:23)
    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)

but when i run npm start it works fine.

any idea how can i fix this?

my versions are: node v8.9.3 npm v5.5.1

Upvotes: 1

Views: 905

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222722

First start the command prompt as a administrator and run

npm install -g @angular/cli -g --save 

Upvotes: 1

Related Questions