Angular compiler-cli& webpack:对象原型可能只是一个Object或null:undefined

时间:2017-07-30 16:50:24

标签: javascript angular webpack webpack-2

我试图重新启动我的旧项目并遇到一些JS意大利面。如果有人能给我一些关于哪个包破坏了什么的线索,我将非常感激。运行npm run build后,我收到此错误:

ERROR in ./src/polyfills.ts
Module build failed: TypeError: Object prototype may only be an Object or null: undefined
    at setPrototypeOf (native)
    at __extends (C:\Users\Gmerc\Documents\GitHub\clt\CLT-webapp\frontend\node_modules\@angular\compiler-cli\src\diagnostics\expression_diagnostics.js:14:9)
    at C:\Users\Gmerc\Documents\GitHub\clt\CLT-webapp\frontend\packages\compiler-cli\src\diagnostics\expression_diagnostics.ts:186:44
    at Object.<anonymous> (C:\Users\Gmerc\Documents\GitHub\clt\CLT-webapp\frontend\packages\compiler-cli\src\diagnostics\expression_diagnostics.ts:186:1)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\Gmerc\Documents\GitHub\clt\CLT-webapp\frontend\packages\compiler-cli\index.ts:15:1)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Symbol.Symbol._symbol._program (C:\Users\Gmerc\Documents\GitHub\clt\CLT-webapp\frontend\node_modules\ngast\ngast.bundle.js:2:138)
    at Object.<anonymous> (C:\Users\Gmerc\Documents\GitHub\clt\CLT-webapp\frontend\node_modules\ngast\ngast.bundle.js:5:2)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)

这是我的polyfills.ts文件的样子:

import 'core-js/client/shim';
import 'reflect-metadata';
require('zone.js/dist/zone');

import 'ts-helpers';

if (process.env.ENV === 'build') {
  // Production

} else {
  // Development

  Error['stackTraceLimit'] = Infinity;

  require('zone.js/dist/long-stack-trace-zone');
}

这段代码在1-2个月前完成了所有工作,但现在似乎有些事情会导致休息。有任何想法吗?这是我的package.json以供参考:

{
  "name": "app",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "clean": "rimraf node_modules doc dist && npm cache clean",
    "clean-install": "npm run clean && npm install",
    "clean-start": "npm run clean-install && npm start",
    "watch": "webpack --watch --progress --profile",
    "build": "rimraf dist && webpack --progress --profile --bail",
    "server": "webpack-dev-server --inline --progress --port 8080",
    "webdriver-update": "webdriver-manager update",
    "webdriver-start": "webdriver-manager start",
    "lint": "tslint --force \"src/**/*.ts\"",
    "e2e": "protractor",
    "e2e-live": "protractor --elementExplorer",
    "pretest": "npm run lint",
    "test": "karma start",
    "posttest": "remap-istanbul -i coverage/json/coverage-final.json -o coverage/html -t html",
    "test-watch": "karma start --no-single-run --auto-watch",
    "ci": "npm run e2e && npm run test",
    "docs": "typedoc --options typedoc.json src/app/app.component.ts",
    "start": "npm run server",
    "start:hmr": "npm run server -- --hot",
    "postinstall": "npm run webdriver-update"
  },
  "dependencies": {
    "@angular/animations": "^4.0.0",
    "@angular/common": "4.0.0",
    "@angular/compiler": "4.0.0",
    "@angular/core": "4.0.0",
    "@angular/forms": "4.0.0",
    "@angular/http": "4.0.0",
    "@angular/material": "^2.0.0-beta.2",
    "@angular/platform-browser": "4.0.0",
    "@angular/platform-browser-dynamic": "4.0.0",
    "@angular/router": "4.0.0",
    "@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.22",
    "angular-calendar": "^0.10.1",
    "angular2-jwt": "^0.1.28",
    "ng2-file-upload": "^1.2.0",
    "auth0-lock": "^10.11.0",
    "bootstrap": "^3.3.7",
    "core-js": "^2.4.1",
    "jquery": "^3.1.1",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.2.0",
    "zone.js": "^0.8.5"
  },
  "devDependencies": {
    "@angularclass/hmr": "^1.0.1",
    "@angularclass/hmr-loader": "^3.0.2",
    "@types/core-js": "0.9.39",
    "@types/es6-shim": "^0.31.32",
    "@types/jasmine": "2.5.46",
    "@types/jquery": "^2.0.40",
    "@types/lodash": "4.14.58",
    "@types/node": "^7.0.11",
    "@types/selenium-webdriver": "3.0.0",
    "angular2-router-loader": "^0.3.5",
    "angular2-template-loader": "^0.6.0",
    "autoprefixer": "^6.3.2",
    "awesome-typescript-loader": "^3.1.2",
    "codelyzer": "3.0.0-beta.4",
    "copy-webpack-plugin": "^4.0.0",
    "css-loader": "^0.27.3",
    "es6-shim": "^0.35.3",
    "extract-text-webpack-plugin": "^2.0.0-beta.4",
    "file-loader": "^0.10.1",
    "html-loader": "^0.4.0",
    "html-webpack-plugin": "^2.8.1",
    "istanbul-instrumenter-loader": "^2.0.0",
    "jasmine-core": "^2.3.4",
    "jasmine-spec-reporter": "^3.2.0",
    "json-loader": "^0.5.3",
    "karma": "1.5.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-coverage": "^1.0.0",
    "karma-jasmine": "^1.0.2",
    "karma-mocha-reporter": "^2.0.3",
    "karma-remap-istanbul": "0.6.0",
    "karma-sourcemap-loader": "^0.3.7",
    "karma-webpack": "2.0.3",
    "node-sass": "^4.5.1",
    "null-loader": "0.1.1",
    "postcss-loader": "^1.1.0",
    "protractor": "^5.1.1",
    "raw-loader": "0.5.1",
    "remap-istanbul": "^0.9.5",
    "rimraf": "^2.5.1",
    "sass-loader": "^6.0.3",
    "shelljs": "^0.7.0",
    "style-loader": "^0.16.0",
    "ts-helpers": "^1.1.1",
    "tslint": "^4.3.1",
    "tslint-loader": "^3.3.0",
    "typedoc": "^0.5.1",
    "typescript": "2.2.1",
    "url-loader": "^0.5.6",
    "webpack": "2.3.2",
    "webpack-dev-server": "2.4.2"
  }
}

0 个答案:

没有答案