NG SERVE - Path must be a string. Received undefined
Hello I have a small probleme with angular cli. When I execute this command "ng serve" I have this message :
> ng serve
Path must be a string. Received undefined
TypeError: Path must be a string. Received undefined
at assertPath (path.js:7:11)
at Object.resolve (path.js:186:7)
at Object.getWebpackCommonConfig (C:\Users\webatrio\Desktop\_dev\mdsap\node_modules\angular-cli\models\webpack-build-common.js:90:80)
at new NgCliWebpackConfig (C:\Users\webatrio\Desktop\_dev\mdsap\node_modules\angular-cli\models\webpack-config.js:15:29)
at Class.run (C:\Users\webatrio\Desktop\_dev\mdsap\node_modules\angular-cli\tasks\serve-webpack.js:21:22)
at C:\Users\webatrio\Desktop\_dev\mdsap\node_modules\angular-cli\commands\serve.js:92:26
at process._tickCallback (internal/process/next_tick.js:103:7)
My angular-cli.json
{
"project": {
"version": "1.0.0-beta.19-3",
"name": "mdsap"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"img",
"app/Services/Mocks"
],
"index": "index.html",
"main": "main.ts",
"test": "test.ts",
"tsconfig": "tsconfig.json",
"prefix": "app",
"mobile": false,
"styles": [
"../node_modules/jquery-ui-dist/jquery-ui.min.css",
"../node_modules/jquery-ui-dist/jquery-ui.theme.min.css",
"../node_modules/angular2-data-table/release/datatable.css",
"../node_modules/angular2-data-table/release/material.css",
"./styles/mdsap-fra/theme.min.css"
],
"scripts": [
"../node_modules/jquery/dist/jquery.js",
"../node_modules/jquery-ui-dist/jquery-ui.min.js",
"../node_modules/tether/dist/js/tether.js",
"../node_modules/bootstrap/dist/js/bootstrap.js"
],
"environments": {
"source": "environments/environment.ts",
"rec": "environments/environment.rec.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"addons": [
],
"packages": [
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "less",
"prefixInterfaces": false,
"inline": {
"style": false,
"template": false
},
"spec": {
"class": false,
"component": false,
"directive": false,
"module": false,
"pipe": false,
"service": false
}
}
}
OS?
Windows10
Versions.
angular-cli: 1.0.0-beta.20-4 node: 7.2.1
Repro steps.
ng serve
Sorry for my English
By default ng serve uses the dev environment, which you removed. Just add a dev environment and that should work.
The error message will be cleaner in the next version of Beta. This is what comes out when I run with that package json:
Environment "dev" does not exist.
Thank you very mush !
I received this error on beta 24 because I did not have the "test": "test.ts" entry. While I would prefer not have it as mandatory hopefully the error message will be more clear for all missing properties.
@pietie Correct!! I upgraded to the latest version of cli and end up getting issue but it was working without test: "test.ts" before. Adding test solved the issue. It shouldn't mandate developer to include unnecessary configuration of not required.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.