我安装了webpack并卸载了它,现在我的angular2应用程序不再启动

时间:2016-09-22 19:35:14

标签: angularjs node.js angular webpack

这是我的package.json。

{
  "name": "app=thing",
  "version": "0.0.0",
  "engines": {
    "node": "5.10.1",
    "npm": "3.10.7"
  },
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "start": "ng serve",
    "heroku-postbuild": "typings install && ng build",
    "lint": "tslint \"src/**/*.ts\"",
    "test": "ng test",
    "pree2e": "webdriver-manager update",
    "e2e": "protractor"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "2.0.0",
    "@angular/compiler": "2.0.0",
    "@angular/core": "2.0.0",
    "@angular/forms": "2.0.0",
    "@angular/http": "2.0.0",
    "@angular/platform-browser": "2.0.0",
    "@angular/platform-browser-dynamic": "2.0.0",
    "@angular/router": "3.0.0",
    "core-js": "2.4.1",
    "rxjs": "5.0.0-beta.12",
    "ts-helpers": "1.1.1",
    "zone.js": "0.6.23",
    "@types/jasmine": "2.2.30",
    "angular-cli": "1.0.0-beta.14",
    "codelyzer": "~0.0.26",
    "jasmine-core": "2.4.1",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "2.0.0",
    "karma-cli": "1.0.1",
    "karma-jasmine": "1.0.2",
    "karma-remap-istanbul": "0.2.1",
    "protractor": "4.0.5",
    "ts-node": "1.2.1",
    "tslint": "3.13.0",
    "typescript": "2.0.2",
    "typings": "1.3.3"
  },
  "devDependencies": {
    "@types/jasmine": "^2.2.30"
  }
}

我使用" npm install webpack"安装了webpack。然后我使用" npm卸载webpack"卸载它,现在我的angular2服务器因为" WebpackOptionsValidationError"

而无法启动

这是我到目前为止所尝试的内容:

1)删除node_modules文件夹并重新安装所有软件包 2)git reset --hard(这显然不起作用导致node_modules不在repo中) 3)再次下载repo并运行npm install --save,然后尝试启动服务器,这也不起作用。 4)卸载我系统上所有全局安装的节点包。

我完全不知所措。有任何想法吗?就像webpack仍然以某种方式安装......:S

我这样启动服务器:

ng serve --proxy proxy.conf.json
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration has an unknown property 'tslint'. These properties are valid:
   object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry, externals?, loader?, module?, name?, node?, output?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, stats?, target?, watch?, watchOptions? }
   For typos: please correct them.
   For loader options: webpack 2 no longer allows custom properties in configuration.
     Loaders should be updated to allow passing options via loader options in module.rules.
     Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader:
     plugins: {
       new webpack.LoaderOptionsPlugin({
         // test: /\.xxx$/, // may apply this only for some modules
         options: {
           tslint: ...
         }
       })
     }
 - configuration.module has an unknown property 'preLoaders'. These properties are valid:
   object { exprContextCritical?, exprContextRecursive?, exprContextRegExp?, exprContextRequest?, loaders?, noParse?, rules?, unknownContextCritical?, unknownContextRecursive?, unknownContextRegExp?, unknownContextRequest?, wrappedContextCritical?, wrappedContextRecursive?, wrappedContextRegExp? }
   Options affecting the normal modules (`NormalModuleFactory`).
 - configuration.node.global should be a boolean.
 - configuration.resolve has an unknown property 'root'. These properties are valid:
   object { alias?, aliasFields?, cachePredicate?, descriptionFiles?, enforceExtension?, enforceModuleExtension?, extensions?, fileSystem?, mainFields?, mainFiles?, moduleExtensions?, modules?, plugins?, resolver?, symlinks?, unsafeCache? }
 - configuration.resolve.extensions[0] should not be empty.
    at webpack (/Users/dud/Work/app-thing/client/node_modules/webpack/lib/webpack.js:16:9)
    at Class.exports.default.Task.extend.run (/Users/dud/Work/app-thing/client/node_modules/angular-cli/tasks/serve-webpack.js:23:27)
    at /Users/dud/Work/app-thing/client/node_modules/angular-cli/commands/serve.js:84:26
    at tryCatch (/Users/dud/Work/app-thing/client/node_modules/es6-promise/dist/lib/es6-promise/-internal.js:195:12)
    at invokeCallback (/Users/dud/Work/app-thing/client/node_modules/es6-promise/dist/lib/es6-promise/-internal.js:210:13)
    at publish (/Users/dud/Work/app-thing/client/node_modules/es6-promise/dist/lib/es6-promise/-internal.js:178:7)
    at flush (/Users/dud/Work/app-thing/client/node_modules/es6-promise/dist/lib/es6-promise/asap.js:94:5)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

1 个答案:

答案 0 :(得分:1)

更新package.json以使用angular-cli 1.0.0-beta.15修复它。