无法读取多重中的未定义错误的属性“长度”中的错误

时间:2019-01-09 04:37:16

标签: angular

我已经从GitHub下载了angular项目,当我运行我的项目时,出现异常错误,无法读取未定义的属性'length' ./node_modules/bootstrap/scss/bootstrap.scss中的错误。 /src/scss/style.scss

我认为它的角度版本控制问题可以有人帮助我如何解决此问题?

packages.json

{
  "name": "mega-able-v1.7.2",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --progress --output-hashing=all --port=4600",
    "build": "increase-memory-limit && ng build --prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@agm/core": "^1.0.0-beta.2",
    "@angular/animations": "^5.2.0",
    "@angular/cdk": "^5.2.4",
    "@angular/common": "^5.2.0",
    "@angular/compiler": "^5.2.0",
    "@angular/core": "^5.2.0",
    "@angular/forms": "^5.2.0",
    "@angular/http": "^5.2.0",
    "@angular/material": "^5.2.4",
    "@angular/platform-browser": "^5.2.0",
    "@angular/platform-browser-dynamic": "^5.2.0",
    "@angular/router": "^5.2.0",
    "@ng-bootstrap/ng-bootstrap": "^1.0.0",
    "@swimlane/ngx-datatable": "^11.2.0",
    "angular2-chartjs": "^0.4.1",
    "angular2-notifications": "^0.7.4",
    "bootstrap": "^4.0.0",
    "c3": "^0.4.21",
    "core-js": "^2.4.1",
    "css-animator": "^2.3.0",
    "d3": "^4.13.0",
    "famfamfam-flags": "^1.0.0",
    "font-awesome-scss": "^1.0.0",
    "hammerjs": "^2.0.8",
    "ng-click-outside": "^3.2.0",
    "ng-select": "^1.0.0-rc.4",
    "ng2-file-upload": "^1.3.0",
    "ng2-google-charts": "^3.4.0",
    "ng2-toasty": "^4.0.3",
    "ng2-ui-switch": "^1.0.2",
    "ng2-validation": "^4.2.0",
    "ngx-bar-rating": "^1.1.0",
    "ngx-carousel": "^1.3.5",
    "ngx-chips": "^1.6.5",
    "ngx-color-picker": "^5.3.3",
    "ngx-perfect-scrollbar": "^5.3.5",
    "rxjs": "^5.5.6",
    "screenfull": "^3.3.2",
    "sweetalert2": "^7.13.3",
    "zone.js": "^0.8.19"
  },
  "devDependencies": {
    "@angular/cli": "^1.7.3",
    "@angular/compiler-cli": "^5.2.0",
    "@angular/language-service": "^5.2.0",
    "@types/jasmine": "~2.8.3",
    "@types/jasminewd2": "~2.0.2",
    "@types/jquery": "^3.3.1",
    "@types/node": "~6.0.60",
    "codelyzer": "^4.0.1",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~2.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "^5.4.2",
    "ts-node": "~4.1.0",
    "tslint": "~5.9.1",
    "typescript": "~2.5.3"
  }
}

输出:ng --version

Angular CLI: 7.1.4
Node: 10.0.0
OS: win32 x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.11.4
@angular-devkit/core         7.1.4
@angular-devkit/schematics   7.1.4
@schematics/angular          7.1.4
@schematics/update           0.11.4
rxjs                         6.3.3
typescript                   3.1.6

2 个答案:

答案 0 :(得分:1)

这里是问题:

  1. styles.scss内的angular-cli.json路径和名称错误

    修复

    "styles.scss"

  2. 环境文件丢失。

    修复

    environments目录下创建src目录,并在新创建的environment.ts下创建2个名为environment.prod.tsenvironments的文件。

在两个文件中都添加代码:

export const environment = {
    production: false
};

就是这样! :)

答案 1 :(得分:0)

我解决了以下问题。

  1. 已删除 node_modules 文件夹
  2. 已删除文件 package-lock.json
  3. 运行 npm install 以重新安装软件包依赖项。