webpack1~npm run dev失敗

2017.01.06

nodejs 6.9使用webpack2+vue2,npm run dev起服務失敗。

> vue2@ dev /Users/zhuxu/Documents/playground/vue2-router
> webpack-dev-server --open --inline --hot

/Users/zhuxu/Documents/playground/vue2-router/node_modules/webpack-dev-server/bin/webpack-dev-server.js:385
        throw e;
        ^

TypeError: webpack.validateSchema is not a function
    at new Server (/Users/zhuxu/Documents/playground/vue2-router/node_modules/webpack-dev-server/lib/Server.js:23:33)
    at startDevServer (/Users/zhuxu/Documents/playground/vue2-router/node_modules/webpack-dev-server/bin/webpack-dev-server.js:378:12)
    at /Users/zhuxu/Documents/playground/vue2-router/node_modules/webpack-dev-server/bin/webpack-dev-server.js:324:3
    at /Users/zhuxu/Documents/playground/vue2-router/node_modules/portfinder/lib/portfinder.js:160:14
    at /Users/zhuxu/Documents/playground/vue2-router/node_modules/async/lib/async.js:52:16
    at /Users/zhuxu/Documents/playground/vue2-router/node_modules/async/lib/async.js:269:32
    at /Users/zhuxu/Documents/playground/vue2-router/node_modules/async/lib/async.js:44:16
    at /Users/zhuxu/Documents/playground/vue2-router/node_modules/portfinder/lib/portfinder.js:122:16
    at Server.onListen (/Users/zhuxu/Documents/playground/vue2-router/node_modules/portfinder/lib/portfinder.js:45:7)
    at Server.g (events.js:291:16)

npm ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev"
npm ERR! node v6.9.1
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! vue2@ dev: `webpack-dev-server --open --inline --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue2@ dev script 'webpack-dev-server --open --inline --hot'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the vue2 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     webpack-dev-server --open --inline --hot
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs vue2
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls vue2
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:

網上查到如下方案

Looks like npm bug, since webpack-dev-server@2.1.0-beta.11
 requires webpack@^2.1.0-beta.26
but npm failed to install it.
The easiest way to avoid the issue without updating too much is to change dependency in package.json to
 "webpack-dev-server": "2.1.0-beta.10",

Instead of something like
 "webpack-dev-server": "^2.1.0-beta.9",

"^" char before version says "compatible with". Removing it sticks to the version exactly.
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

  • 每天都有加法的沖動 每天也有減法的念頭 在這個過程中 體會到的是 成長比成功重要
    天籟村閱讀 196評論 0 0
  • 今天要畫T恤和紫色蝴蝶結,卻讓我無從下手,這張是跟著鈴鐺子老師視頻畫下來的,不得不承認我前面的胡亂臨摹讓我...
    金圓迪閱讀 194評論 0 3
  • 在靜好的歲月里 不爭不擾 若不是那年任性 怎會 掙脫靜好.投身喧囂 若不是那份偏執(zhí) 何須 戰(zhàn)戰(zhàn)兢兢.故作美好 若不...
    Y余小姐閱讀 246評論 0 0

友情鏈接更多精彩內容