加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

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

发布时间:2020-12-17 18:11:22 所属栏目:安全 来源:网络整理
导读:我是角度新手6我从 link下载了现成的角度模板 导航到根文件夹执行npm install尝试运行应用程序ng服务但它显示错误 Local workspace file (‘angular.json’) could not be found. 的package.json { "name": "angular-6-registration-login-example","version
我是角度新手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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读