Error: Cannot find module 'webpack'

Error: Cannot find module 'webpack'

已安装

cnpm install --save-dev webpack
cnpm install webpack-dev-server

仍旧报错
使用系统:windows10
使用命令:
错误命令:

./node_modules.bin/webpack app/main.js public/bundle.js 注意:在windows下使用反斜杠执行命令

正确命令

.\node_modules\.bin\webpack .\app\main.js .\public\budle.js
PS C:\Users\Administrator\Desktop\webpack> .\node_modules\.bin\webpack .\app\main.js .\public\budle.js
Hash: 480969dcbeb23a666f35
Version: webpack 4.17.2
Time: 350ms
Built at: 2018-09-08 00:15:53
          1 asset
Entrypoint main = main.js
[0] multi ./app/main.js ./public/budle.js 40 bytes {0} [built]
[1] ./app/main.js 97 bytes {0} [built]
[2] ./app/Greeter.js 154 bytes {0} [built]

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/concepts/mode/

ERROR in multi ./app/main.js ./public/budle.js
Module not found: Error: Can't resolve '.\public\budle.js' in 'C:\Users\Administrator\Desktop\webpack'
          @ multi ./app/main.js ./public/budle.js main[1]

报错:

ERROR in multi ./app/main.js ./public/budle.js

原因:

C:\Users\Administrator\Desktop\webpack> webpack -v

4.17.2

版本过高,之前的命令已经失效

.\node_modules\.bin\webpack .\app\main.js -o .\public\budle.js

你可能感兴趣的:(webpack)