Angularjs Angular ng serve无效:serve命令需要在Angular项目中运行,但找不到项目定义
当我在我的角度项目中使用ng serve(在正确的位置)时,它会在cmd中显示此错误Angularjs Angular ng serve无效:serve命令需要在Angular项目中运行,但找不到项目定义,angularjs,angular,Angularjs,Angular,当我在我的角度项目中使用ng serve(在正确的位置)时,它会在cmd中显示此错误 The serve command requires to be run in an Angular project, but a project definition could not be found. 我也试试这个 但这对我来说也不管用。 我还尝试删除节点模块并重新安装,但没有成功。当我使用npm开始它的工作。 为什么?有什么问题 我的angular-cli.json代码在这里 "project
The serve command requires to be run in an Angular project, but a project definition could not be found.
我也试试这个
但这对我来说也不管用。
我还尝试删除节点模块并重新安装,但没有成功。当我使用npm开始它的工作。
为什么?有什么问题
我的angular-cli.json代码在这里
"project": {
"version": "1.0.0-beta.28.3",
"name": "angular-src"
},
"apps": [
{
"root": "src",
"outDir": "../public",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.json",
"prefix": "app",
"styles": [
"styles.css"
],
"scripts": [],
"environments": {
"source": "environments/environment.ts",
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"files": "src/**/*.ts",
"project": "src/tsconfig.json"
},
{
"files": "e2e/**/*.ts",
"project": "e2e/tsconfig.json"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"prefixInterfaces": false,
"inline": {
"style": false,
"template": false
},
"spec": {
"class": false,
"component": true,
"directive": true,
"module": false,
"pipe": true,
"service": true
}
}
}
从这里得到裁判
之前,请确保您位于终端的项目目录中
正在运行“ng serve”
假设您的文件夹结构如下所示:
|-Documents
|---my_projects
|-----angular_project
例如,确保您的终端位于“angular_项目”中。i、 e
username@PC_NAME:~/Documents/my_projects/angular_project$ ng serve
你能发布你的angular.json文件吗?我只得到angular-cli.json(显示在这里)。不是angular.json。我是这样运行的。但只有npm运行工作。ng serve不起作用。能否共享您的package.json?这是如何配置npm脚本的问题。
|-Documents
|---my_projects
|-----angular_project
username@PC_NAME:~/Documents/my_projects/angular_project$ ng serve