gpt4 book ai didi

Angular 6 : Local workspace file ('angular.json' ) could not be found

转载 作者:太空狗 更新时间:2023-10-29 17:28:22 26 4
gpt4 key购买 nike

我是 Angular 6 的新手,我已经从 link 下载了现成的 Angular 模板。

导航到根文件夹并执行 npm install 尝试运行应用程序 ng serve 但它显示错误

Local workspace file ('angular.json') could not be found.

包.json

{
"name": "angular-6-registration-login-example",
"version": "1.0.0",
"repository": {
"type": "git",
"url": "https://github.com/cornflourblue/angular-6-registration-login-example.git"
},
"scripts": {
"build": "webpack --mode production",
"start": "webpack-dev-server --mode development --open"
},
"license": "MIT",
"dependencies": {
"@angular/common": "^6.0.0",
"@angular/compiler": "^6.0.0",
"@angular/core": "^6.0.0",
"@angular/forms": "^6.0.0",
"@angular/platform-browser": "^6.0.0",
"@angular/platform-browser-dynamic": "^6.0.0",
"@angular/router": "^6.0.0",
"core-js": "^2.5.5",
"rxjs": "^6.1.0",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@types/node": "^10.0.4",
"angular2-template-loader": "^0.6.2",
"html-webpack-plugin": "^3.2.0",
"raw-loader": "^0.5.1",
"ts-loader": "^4.3.0",
"typescript": "^2.8.3",
"webpack": "4.8.1",
"webpack-cli": "^2.1.3",
"webpack-dev-server": "3.1.4"
}
}

我的环境配置是,

Angular CLI: 6.0.3
Node: 8.11.2
OS: linux x64
Angular: 6.0.3
... common, compiler, core, forms, platform-browser
... platform-browser-dynamic, router

Package Version
------------------------------------------------------
@angular-devkit/architect 0.6.3 (cli-only)
@angular-devkit/core 0.6.3 (cli-only)
@angular-devkit/schematics 0.6.3 (cli-only)
@schematics/angular 0.6.3 (cli-only)
@schematics/update 0.6.3 (cli-only)
rxjs 6.2.0
typescript 2.8.4
webpack 4.8.1

请帮我解决这个问题。

最佳答案

由于您的项目不使用 Angular-CLI,您无法执行 ng serve 导致错误,因为 ng serve 寻找此配置文件来启动您的应用程序

Local workspace file ('angular.json') could not be found.

它使用 webpack 并且所有的 webpack 配置都存储在 webpack.config.js 中。
如果你观察你的 package.json 你可以在脚本部分 startbuild

下看到
"scripts": {
"build": "webpack --mode production",
"start": "webpack-dev-server --mode development --open"
},

您可以使用 npm
执行这些脚本 执行 npm run start 进行开发构建

关于 Angular 6 : Local workspace file ('angular.json' ) could not be found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50631208/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com