devDependencies“找不到模块”错误

时间:2016-11-04 16:14:11

标签: npm webpack package.json

我将devDependenciesdependencies

之间的依赖关系分开了
{
  "name": "contenttype",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "react": "^15.3.2",
    "react-dom": "^15.3.2"
  },
  "scripts": {
    "dev": "webpack-dev-server --content-base src --inline --hot"
  },
  "devDependencies": {
    "babel-core": "^6.18.2",
    "babel-loader": "^6.2.7",
    "babel-preset-es2015": "^6.18.0",
    "babel-preset-react": "^6.16.0",
    "webpack": "^1.13.3"
  }
}

正如您所看到的,我有一个npm脚本,但当我运行npm run dev时,我收到了错误

webpack module not found

为什么? webpack模块位于我的devDependencies中,为什么不进行重新识别?

1 个答案:

答案 0 :(得分:1)

npm install webpack-dev-server --save-dev