javascript - Angular Cli ng serve don't work -
when try run ng serve got error :
the "@angular/compiler-cli" package not installed. error: typeerror : object prototype may object or null: undefined error: "@angular/compiler-cli" package not installed. error: ty peerror: object prototype may object or null: undefined @ object.<anonymous> (c:\users\mounadi\angular2-quickstart\node_modules\@ng tools\webpack\src\index.js:14:11) @ module._compile (module.js:570:32) @ object.module._extensions..js (module.js:579:10) @ module.load (module.js:487:32) @ trymoduleload (module.js:446:12) @ function.module._load (module.js:438:3) @ module.require (module.js:497:17) @ require (internal/module.js:20:19) @ object.<anonymous> (c:\users\mounadi\angular2-quickstart\node_modules\@an gular\cli\tasks\eject.js:10:19) @ module._compile (module.js:570:32) @ object.module._extensions..js (module.js:579:10) @ module.load (module.js:487:32) @ trymoduleload (module.js:446:12) @ function.module._load (module.js:438:3) @ module.require (module.js:497:17) @ require (internal/module.js:20:19) i tried uninstall @angular/cli , install @angular/cli@latest , got same error
follow below steps start angular cli.
first update node version:
- so, first check node version typing command
node -v. if node version lower 6.x.x update because angular cli requires node version higher 6.x.x. update node version run below command.
nvm install <new version> --reinstall-packages-from=<old version>ex: nvm install 7.10.0 --reinstall-packages-from=5.1.0then run command:
nvm use 7.10.0after run command
npm install -g @angular/cliinstall angular cli.- then
ng new my-new-projectcreate new project. - then
cd my-new-projectgo inside created project directory. - and
ng serverun app.
extra: update angular 2 project angular 4 project run below command:
* on linux/mac: npm install @angular/{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform- server,router,animations}@next --save server,router,animations}@next --save * on windows: npm install @angular/common@next @angular/compiler@next @angular/compiler-cli@next @angular/core@next @angular/forms@next @angular/http@next @angular/platform-browser@next @angular/platform-browser-dynamic@next @angular/platform-server@next @angular/ router@next @angular/animations@next --save
Comments
Post a Comment