我安装并卸载了webpack,现在我的angular2应用程序不能再运行了

时间:2021-05-09 15:20:33

Here's my package.json.

这是我的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"
  }
}

I installed webpack using "npm install webpack" and then I uninstalled it using "npm uninstall webpack", now I my angular2 server won't start, because of a "WebpackOptionsValidationError"

我使用“npm install webpack”安装了webpack,然后使用“npm uninstall webpack”卸载了它,现在由于“WebpackOptionsValidationError”,我的angular2服务器不会启动

Here's what I tried so far:

以下是我迄今为止所尝试的:

1) Trashing the node_modules folder and reinstalling all the packages 2) git reset --hard (this obviously doesn't work cause node_modules isn't in the repo) 3) Downloading the repo again and running npm install --save, and then trying to start the server, and that doesn't work either. 4) Uninstalling all the globally installed node packages on my system.

1)删除node_modules文件夹,并重新安装所有的包2)git reset——很难(这显然不工作,因为node_modules不在repo中)下载repo,运行npm安装——保存,然后尝试启动服务器,这也不起作用。4)在我的系统上卸载所有全局安装的节点包。

I'm totally baffled. Any ideas? It's like webpack is still installed somehow... :S

我完全困惑。什么好主意吗?好像webpack还在安装……:年代

I'm starting the server like this:

我这样启动服务器:

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 个解决方案

#1


1  

Updating the package.json to use angular-cli 1.0.0-beta.15 fixed it.

更新包。json使用angular-cli 1.0.0-beta。15固定它。

#1


1  

Updating the package.json to use angular-cli 1.0.0-beta.15 fixed it.

更新包。json使用angular-cli 1.0.0-beta。15固定它。