首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >找不到模块“@angular/core/testing”

找不到模块“@angular/core/testing”
EN

Stack Overflow用户
提问于 2019-09-03 13:29:32
回答 1查看 2.8K关注 0票数 0

我得到一个错误作为Cannot find module '@angular/core/testing' -与我的规范文件。如何解决这个问题?

有谁能帮我吗?我使用的是angular 8,这是我的tsconfig.json文件:

代码语言:javascript
复制
{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./src",
    "paths": {
      "*": [
        "node_modules/*",
        "src/types/*"
      ]
    },
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "esnext",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es2015",
    "downlevelIteration": true,
    "typeRoots": [
      "node_modules/@types"
    ],
    "paths": {
      "jszip": [
        "node_modules/jszip/dist/jszip.min.js"
      ]
    },
    "paths": {
      "globalize": [
        "node_modules/globalize/dist/globalize"
      ],
      "globalize/*": [
        "node_modules/globalize/dist/globalize/*"
      ],
      "cldr": [
        "node_modules/cldrjs/dist/cldr"
      ],
      "cldr/*": [
        "node_modules/cldrjs/dist/cldr/*"
      ],
      "jszip": [
        "node_modules/jszip/dist/jszip.min.js"
      ]
    },
    "lib": [
      "es2018",
      "dom",
      "dom.iterable"
    ]
  },
   "exclude": [
        "node_modules",
        "**/*.spec.ts"
    ],
}

添加我的Package.json:

代码语言:javascript
复制
{
  "name": "vnc",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "jest",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "compodoc": "./node_modules/.bin/compodoc -p src/tsconfig.app.json",
    "generate-docs": "compodoc -p src/tsconfig.app.json",
    "serve-docs": "compodoc -s src/tsconfig.app.json",
    "test:watch": "jest --watch",
    "test:ci": "jest -ci --runInBand"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^9.0.0-next.3",
    "@angular/cdk": "^8.1.2",
    "@angular/cli": "^8.3.0",
    "@angular/common": "~9.0.0-next.3",
    "@angular/compiler": "^9.0.0-next.3",
    "@angular/core": "^9.0.0-next.3",
    "@angular/forms": "~9.0.0-next.3",
    "@angular/platform-browser": "~9.0.0-next.3",
    "@angular/platform-browser-dynamic": "~9.0.0-next.3",
    "@angular/router": "~9.0.0-next.3",
    "@briebug/jest-schematic": "^1.7.0",
    "@ng-select/ng-select": "^3.0.6",
    "@ngrx/core": "^1.2.0",
    "@ngrx/data": "^8.2.0",
    "@ngrx/effects": "^8.2.0",
    "@ngrx/router-store": "^8.2.0",
    "@ngrx/store": "^8.0.1",
    "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "@types/jest": "^24.0.18",
    "angular-calendar": "^0.27.11",
    "bootstrap": "^4.3.1",
    "core-js": "^3.1.4",
    "date-fns": "^1.30.1",
    "jest-createspyobj": "^1.2.2",
    "jquery": "^3.4.1",
    "lodash": "^4.17.11",
    "microsoft-adal-angular6": "^1.3.0",
    "ng2-file-upload": "^1.3.0",
    "ngx-contextmenu": "^5.2.0",
    "node-sass": "^4.12.0",
    "popper.js": "^1.15.0",
    "rxjs": "~6.5.2",
    "simplebar": "^4.1.0",
    "tslib": "^1.10.0",
    "zone.js": "~0.10.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.803.0",
    "@angular/compiler-cli": "^9.0.0-next.3",
    "@angular/language-service": "~9.0.0-next.3",
    "@compodoc/compodoc": "^1.1.9",
    "@ngrx/store-devtools": "^8.0.1",
    "@types/jasminewd2": "~2.0.3",
    "@types/jquery": "^3.3.29",
    "@types/lodash": "^4.14.134",
    "@types/node": "~12.7.1",
    "angular-cli": "^1.0.0-beta.28.3",
    "codelyzer": "^5.0.1",
    "compodoc": "0.0.41",
    "gulp-sass": "^4.0.2",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "jest": "^24.9.0",
    "jest-preset-angular": "7.1.1",
    "ngrx-store-freeze": "^0.2.4",
    "protractor": "~5.4.0",
    "ts-node": "~8.3.0",
    "tslint": "~5.18.0",
    "typescript": "~3.5.3"
  }
}
EN

回答 1

Stack Overflow用户

发布于 2019-09-03 14:16:18

我认为angular v9.0已经做了一些改变,所以他们可能会到处移动东西,这样你就找不到angular/core/testing包了。

你可以试试我的package.json

代码语言:javascript
复制
"@angular/animations": "~8.1.2",
"@angular/common": "~8.1.2",
"@angular/compiler": "~8.1.2",
"@angular/core": "~8.1.2",
"@angular/forms": "~8.1.2",
"@angular/platform-browser": "~8.1.2",
"@angular/platform-browser-dynamic": "~8.1.2",
"@angular/router": "~8.1.2",

现在我使用的是angular 8.1.2

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57765539

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档