Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot read property 'config' of null

I am new in angular2. I have downloaded angular 2 project and tried to setup. I installed angular cli 1.0.0-rc.2 and when I am doing ng serve it is showing the below error:

Cannot read property 'config' of null TypeError: Cannot read property 'config' of null at Class.run (D:\Sumit\AgulaNew\admin\node_modules\@angular\cli\tasks\serve.js:22:63) at check_port_1.checkPort.then.port (D:\Sumit\AgulaNew\admin\node_modules\@angular\cli\commands\serve.js:103:26) at at process._tickCallback (internal/process/next_tick.js:188:7)

like image 936
Sumit Rawat Avatar asked Sep 21 '17 15:09

Sumit Rawat


3 Answers

I had the same error this morning.

You probably copied your project from one folder to another using Finder or Explorer. If so, the file .angular-cli.json is missing.

If you are using a Mac, use the command ls -a to list hidden files. You will notice that .angular-cli.json will be there. Just copy the file to the new location and your problem will be solved.

like image 131
Otacilio Oliveira Avatar answered Oct 13 '22 18:10

Otacilio Oliveira


I once git cloned a project where

ng -serve 

failed.

This was because .angular-cli.json was missing.

On the other and

npm start

did the job instead ;-)

Typically the project from angular tutorial webpack guide downloadable from webpack.zip confirms the case

like image 32
user1767316 Avatar answered Oct 13 '22 16:10

user1767316


Cannot read property 'config' of null is a typical error when .angular-cli.json is missing.

BTW you do not need any seed projects as a base for your new app and there is no reason to use outdated angular cli 1.0.0-rc.2 as you mention.

Check the latest releases https://github.com/angular/angular-cli/releases or with npm show @angular/cli version then install the latest npm install -g @angular/cli and generate a new project with that. To see your local CLI version run ng -v

Also checkout the recent article The Past, Present, and Future of the Angular CLI by one of the core Angular team mebers @StephenFluin

like image 35
angularrocks.com Avatar answered Oct 13 '22 18:10

angularrocks.com