​报这个错怎么办

来源:3-2 配置vue的jsx写法以及postcss

weixin_慕九州5212616

2020-10-27 17:01


PS D:\my\work\practiceDemo\vue-ssr-tech> npm run dev


> vue-ssr-tech@1.0.0 dev D:\my\work\practiceDemo\vue-ssr-tech

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


internal/modules/cjs/loader.js:968

  throw err;

  ^


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

Require stack:

- D:\my\work\practiceDemo\vue-ssr-tech\node_modules\webpack-dev-server\bin\webpack-dev-server.js

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

    at Function.Module._load (internal/modules/cjs/loader.js:841:27)

    at Module.require (internal/modules/cjs/loader.js:1025:19)

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

    at Object.<anonymous> (D:\my\work\practiceDemo\vue-ssr-tech\node_modules\webpack-dev-server\bin\webpack-dev-server.js:54:1)

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

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

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

    at Function.Module._load (internal/modules/cjs/loader.js:878:14)

    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {

  code: 'MODULE_NOT_FOUND',

  requireStack: [

    'D:\\my\\work\\practiceDemo\\vue-ssr-tech\\node_modules\\webpack-dev-server\\bin\\webpack-dev-server.js'

  ]

}

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\lingyun\AppData\Roaming\npm-cache\_logs\2020-10-27T08_59_13_905Z-debug.log


写回答 关注

2回答

  • Clloz
    2020-11-16 20:34:45

    把 webpack-dev-server 换成 webpack serve 命令,webpack 5 使用这个新的命令替代了原来的

  • Mei丶没时间
    2020-10-29 10:22:10

    webpack-cli 版本太高了,降低版本

Vue+Webpack打造todo应用

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

84606 学习 · 787 问题

查看课程

相似问题