Could not find API compiler-cli, function VERSION Error: Could not find API compiler-cli, function VERSION

I created a new angular 6 app, when I try to run the app using ng serve --open it gives this error. what might be causing the error and what should I do to fix this?


    Could not find API compiler-cli, function VERSION Error: Could not find API compiler-cli, function VERSION
    at _error (/home/linux/Documents/angu/my-app/node_modules/@ngtools/webpack/src/ngtools_api.js:8:11)
    at getApiMember (/home/linux/Documents/angu/my-app/node_modules/@ngtools/webpack/src/ngtools_api.js:11:32)
    at Object.<anonymous> (/home/linux/Documents/angu/my-app/node_modules/@ngtools/webpack/src/ngtools_api.js:50:19)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/home/linux/Documents/angu/my-app/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:28:23)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)

1 answer

  • answered 2019-08-14 12:18 Ramachandran

    Try this

    Step 1: npm install -g @angular/cli@latest 
    Step 2: ng new name-of-project (ignore if project already created) 
    Step 3: cd name-of-project (ignore if project already created) 
    Step 4: npm install @angular/cli --save-dev 
    Step 5: npm install @angular/compiler-cli --save-dev 
    Step 6: ng serve