vue-admin-element項目突然就起不來瞭的解決

vue-admin-element項目突然就起不來

INFO  Starting development server…
 ERROR  WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 – configuration.name should be a string.
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 – configuration.name should be a string.
   -> Name of the configuration. Used when loading multiple configurations.
    at webpack (E:\qdyh\trunk\qdyh-web\node_modules\webpack\lib\webpack.js:31:9)
    at serve (E:\qdyh\trunk\qdyh-web\node_modules\@vue\cli-service\lib\commands\serve.js:135:22)
    at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
 
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\hyx\AppData\Roaming\npm-cache\_logs\2020-04-28T08_05_55_780Z-debug.log
PS E:\qdyh\trunk\qdyh-web> npm i
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

如果你的項目什麼也沒有改動,啟動時突然報以上錯誤,那有可能是環境出現瞭某些問題,這時候可以刪除node_modules,重新裝,這時解決npm WARN [email protected] No repository field.這個警告

解決方案如下

npm WARN XXXXXXXX No repository field.問題

這是因為刪除node_modules文件,導致之前與代碼倉庫的聯系消失,有兩種解決方案

一、將項目設置為私有

在package.json中添加

"private": true

二、將項目的倉庫地址添上即可

"repository": {
        "type": "git",
        "url": "http://baidu.com"
    }

以上為個人經驗,希望能給大傢一個參考,也希望大傢多多支持WalkonNet。

推薦閱讀: