webpack 4.X npm run start 鎶ラ敊

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了webpack 4.X npm run start 鎶ラ敊相关的知识,希望对你有一定的参考价值。

鏍囩锛?a href='http://www.mamicode.com/so/1/his' title='his'>his   resolve   star   rds   uil   oba   sudo   ddl   span   

package.json:

{
  "name": "webpack",
  "version": "1.0.0",
  "description": "",
  "main": "webpack.config.js",
  "scripts": {
    "test": "echo "Error: no test specified" && exit 1",
    "build": "webpack",
    "start": "webpack-dev-server"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "jquery": "^3.3.1"
  },
  "devDependencies": {
    "webpack-dev-server": "^3.1.5"
  }
}

 

bogon:webpack cristin$ npm run start

> [email protected] start /Users/cristin/Documents/webpack
> webpack-dev-server

module.js:487
throw err;
^

Error: Cannot find module 鈥榳ebpack鈥?br> at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/cristin/Documents/webpack/node_modules/webpack-dev-server/lib/Server.js:22:17)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `webpack-dev-server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start 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! /Users/cristin/.npm/_logs/2018-07-23T03_08_57_715Z-debug.log
bogon:webpack cristin$ sudo npm install webpack-dev-server
Password:
npm WARN [email protected] requires a peer of [email protected]^4.0.0-beta.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected]^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

+ [email protected]
updated 2 packages in 12.044s
bogon:webpack cristin$





























以上是关于webpack 4.X npm run start 鎶ラ敊的主要内容,如果未能解决你的问题,请参考以下文章

通过 npm run 运行 Webpack 失败

npm run 是什么?为什么使用npm run 这一命令,就能够将 webpack 跑起来并进行下一步的操作?

关于vue的npm run dev和npm run build

为啥 webpack 在运行 npm run dev 时会报错

如何使用 npm-start 解决 react webpack 问题

挂在 ts-loader (webpack) 上的“npm run”