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 ‘webpack‘
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$
原文地址:https://www.cnblogs.com/cristin/p/9353656.html