npm run dev 就报这个错,求大佬帮忙看一下

来源:2-3 webpack-dev-server的配置和使用

qq_转身说再见_1

2021-01-14 18:30

PS G:\VUE学习\vue-ssr-tech> npm run dev


> vue-ssr-tech@1.0.0 dev G:\VUE学习\vue-ssr-tech

> cross-env NODE_ENV=development webpack-dev-server --config webpack.config.js


internal/modules/cjs/loader.js:583

    throw err;

    ^


Error: Cannot find module 'webpack-cli/bin/config-yargs'

    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)

    at Function.Module._load (internal/modules/cjs/loader.js:507:25)

    at Module.require (internal/modules/cjs/loader.js:637:17)

    at require (internal/modules/cjs/helpers.js:20:18)

    at Object.<anonymous> (G:\VUE学习\vue-ssr-tech\node_modules\webpack-dev-server\bin\webpack-dev-server.js:65:1)

    at Module._compile (internal/modules/cjs/loader.js:689:30)

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)

    at Module.load (internal/modules/cjs/loader.js:599:32)

    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)

    at Function.Module._load (internal/modules/cjs/loader.js:530:3)

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! vue-ssr-tech@1.0.0 dev: `cross-env NODE_ENV=development webpack-dev-server --config webpack.config.js`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the vue-ssr-tech@1.0.0 dev 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!     C:\Users\FineEx\AppData\Roaming\npm-cache\_logs\2021-01-14T10_27_38_846Z-debug.log


写回答 关注

5回答

  • 慕函数4171128
    2021-01-15 16:37:28
    已采纳

    webpack 版本高了, 安装webpack@4.x

  • 珠泫
    2021-05-26 12:43:14

    问一下怎么解决的

  • 慕村4381839
    2021-01-29 17:55:34

    可以用高级版本 webpac5 但是 命令要使用

    "dev": "cross-env NODE_ENV=development webpack serve --config webpack.config.js"

    在高级版本的时候 devtool 也需要这样

    config.devtool = 'eval-cheap-module-source-map'


  • 慕青33
    2021-01-16 19:49:10

    卸载当前webpack-cli:npm uninstall webpack-cli; 安装webpack-cli 3*版本:npm install webpack-cli@3 -D


    qq_转身说...

    谢谢,已解决

    2021-01-18 11:40:32

    共 1 条回复 >

  • 慕函数4171128
    2021-01-15 16:40:13

    http://img4.mukewang.com/600154be0001d99404140086.jpg

    webpack-cli 版本高了,可能也会有影响, 我降到这几个版本,可以跑

    qq_转身说...

    谢谢,已解决

    2021-01-18 11:39:58

    共 1 条回复 >

Vue+Webpack打造todo应用

用前端最热门框架Vue+最火打包工具Webpack打造todo应用

84606 学习 · 787 问题

查看课程

相似问题