Error: Cannot find module 'webpack'

Error: Cannot find module 'webpack'

已安裝node

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

仍舊報錯
使用系統:windows10
使用命令:
錯誤命令:webpack

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

正確命令web

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

報錯:npm

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

緣由:windows

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

4.17.2app

版本太高,以前的命令已經失效webpack-dev-server

.\node_modules\.bin\webpack .\app\main.js -o .\public\budle.js
相關文章
相關標籤/搜索