运行 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
也需局部安装(本项目)依赖;