Search code examples
angularcommand-line-interfacejsonschemaserve

ng serve issue Cannot find module '@ngtools/json-schema' on mac


On my windows machine i can run ng serve but when i try it on mac i get this error:

module.js:544
    throw err;
    ^

Error: Cannot find module '@ngtools/json-schema'
    at Function.Module._resolveFilename (module.js:542:15)
    at Function.Module._load (module.js:472:25)
    at Module.require (module.js:585: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:641:30)
    at Object.Module._extensions..js (module.js:652:10)
    at Module.load (module.js:560:32)
    at tryModuleLoad (module.js:503:12)
    at Function.Module._load (module.js:495:3)

i tried to npm install json-schema but it doesn't help. any suggestions?


Solution

  • Try removing node and npm and install it again. Use the following versions:

    • Node 8.0.0
    • npm 5.0.0: $ npm install npm@5.0.0
    • angular-cli 1.0.0: $ npm install -g @angular/cli@1.0.0