Reputation: 361
I have a issue with Angular 2. When i want to start server it get this:
$ ng serve
Cannot read property 'config' of null
TypeError: Cannot read property 'config' of null
at Class.run (C:\Users\Damien\Desktop\application\node_modules\@angul ar\cli\tasks\serve.js:22:63)
at check_port_1.checkPort.then.port (C:\Users\Damien\Desktop\application\node_modules\@angular\cli\commands\serve.js:103:26)
at process._tickCallback (internal/process/next_tick.js:103:7)
I reinstalled CLI and nothing else is working. I could be something with json file?
Upvotes: 33
Views: 47439
Reputation: 9
http://javasampleapproach.com/aws/angular-4-amazon-s3-example-how-to-upload-file-to-s3-bucket
in your tsconfig.app.json file put this
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "./",
"module": "es2015",
"types": ["node"]
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
Upvotes: -1
Reputation: 181
this error is coming due to removal of .angular-cli.json so first add this on root folder. if after that still get error then check static file in .angular-cli.json
Upvotes: 4
Reputation: 5525
you missing .angular-cli.json,
you can generate it by(go to a new folder)
ng new project-name
now copy .angular-cli.json file to your project root.
ng serve
the error should be gone.
Upvotes: 5
Reputation: 37
https://angular.io/guide/quickstart
Step 3: Serve the application Go to the project directory and launch the server.
content_copy cd my-app ng serve --open
May be you missed the point 3 (cd my-app)? The start directory have been like: ./my-app/my-app. If start application from other directory we get this error.
Upvotes: 2
Reputation: 4254
Please add following file at root folder File Name-.angular-cli.json
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "XXXX"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"assets/css/styles.css"
],
"scripts": [
"assets/js/project.js"
],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json"
},
{
"project": "src/tsconfig.spec.json"
},
{
"project": "e2e/tsconfig.e2e.json"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"component": {}
}
}
Upvotes: 10
Reputation: 351
Make Sure You are inside the project folder. This may happen when the programmer has a folder for Practice purpose for eg: says "MyWorkOuts" folder. in which the programmer may have lot of practice app says:practice1,practice2,etc...
I use VS code in which make sure the terminal is in the exact angular application you try to start.
this may look simple or even silly. But while learning all happens. after making sure you may follow the other solutions of our stackoverflow friends.
Thank You guys Good Day :-)
Upvotes: 1
Reputation: 106
The problem could be a mising file .angular-cli.json
, do not forget the extension .json
which implies the file format. Copy this file from the original project and paste it into your currrent project.
Upvotes: 0
Reputation: 1855
Probably you remove project into other folder, or delete .angular-cli.json
Into the root of your app, add: .angular-cli.json
and paste:
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "PROJECT_NAME"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json"
},
{
"project": "src/tsconfig.spec.json"
},
{
"project": "e2e/tsconfig.e2e.json"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"component": {}
}
}
Upvotes: 37
Reputation: 1691
I found the solution!
In my case I moved the project to another directory.
there is a hidden file called .angular-cli
Show the hidden file in the old project and copy this file and paste it in the new distention. This solved the issue for me.
Upvotes: 50
Reputation: 1734
My first suggestion would be to update Angular CLI by following these instructions here. This topic is covered a bit here. The usual culprit is an update of Angular CLI without following the above instructions, but you don't give any specifics on your situation.
Upvotes: 1