執行 cnpm start 運行"webpack-dev-server " 後報錯:沒有找到webpack。
packge.json檔案內容如下:
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server "
},
"author": "",
"license": "ISC",
"dependencies": {
"webpack-dev-server": "^2.4.5"
}
}
webpack.config.js:
#執行 :
報錯:
我全域安裝的webpack 不知道為什麼會報找不到webpack。
但是自己手動輸入 'webpack-dev-server'
運行成功:
#希望知道是什麼原因
試下
npm run start
webpack.config.js
里使用了webpack
,所以webpack
也需局部安裝(本項目)相依性;