Angular 6:找不到本地工作区文件(‘angular.json’)

前端之家收集整理的这篇文章主要介绍了Angular 6:找不到本地工作区文件(‘angular.json’)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我是角度新手6我从 link下载了现成的角度模板

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

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

的package.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服务会查找此配置文件以启动您的应用程序

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

它使用webpack,所有webpack配置都存储在webpack.config.js中.
如果你观察你的package.json,你可以在脚本部分的start和build下看到

"scripts": {
    "build": "webpack --mode production",

你可以使用npm执行这些脚本    为devlopment build执行npm run start

猜你在找的Angularjs相关文章