Error: Cannot find module 'webpack'

created at 07-04-2021 views: 5

error message

Error: Cannot find module 'webpack'


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

Still reporting an error
Use system: windows10

wrong command

./node_modules.bin/webpack app/main.js public/bundle.js 

Note: Use backslashes to execute commands under windows

right command

.\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:

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


The version is too high, the previous command is no longer valid

.\node_modules\.bin\webpack .\app\main.js -o .\public\budle.js
created at:07-04-2021
edited at: 07-04-2021: