问答详情
源自:2-1 vue-loader+webpack项目配置

运行npm run build 报错,已装了webpack-cli

E:\webpack-vue>npm run build


> webpack-vue@1.0.0 build E:\webpack-vue

> webpack --config webpack.config.js


E:\webpack-vue\node_modules\webpack-cli\bin\cli.js:244

                                throw err;

                                ^


Error: Cannot find module 'E:\webpack-vue\webpack.config.js'

    at Function.Module._resolveFilename (module.js:547:15)

    at Function.Module._load (module.js:474:25)

    at Module.require (module.js:596:17)

    at require (E:\webpack-vue\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)

    at WEBPACK_OPTIONS (E:\webpack-vue\node_modules\webpack-cli\bin\convert-argv.js:133:13)

    at requireConfig (E:\webpack-vue\node_modules\webpack-cli\bin\convert-argv.js:135:6)

    at E:\webpack-vue\node_modules\webpack-cli\bin\convert-argv.js:142:17

    at Array.forEach (<anonymous>)

    at module.exports (E:\webpack-vue\node_modules\webpack-cli\bin\convert-argv.js:140:15)

    at yargs.parse (E:\webpack-vue\node_modules\webpack-cli\bin\cli.js:241:39)

    at Object.parse (E:\webpack-vue\node_modules\yargs\yargs.js:552:18)

    at E:\webpack-vue\node_modules\webpack-cli\bin\cli.js:219:8

    at Object.<anonymous> (E:\webpack-vue\node_modules\webpack-cli\bin\cli.js:530:3)

    at Module._compile (module.js:652:30)

    at Object.Module._extensions..js (module.js:663:10)

    at Module.load (module.js:565:32)

    at tryModuleLoad (module.js:505:12)

    at Function.Module._load (module.js:497:3)

    at Module.require (module.js:596:17)

    at require (internal/module.js:11:18)

    at Object.<anonymous> (E:\webpack-vue\node_modules\webpack\bin\webpack.js:157:2)

    at Module._compile (module.js:652:30)

    at Object.Module._extensions..js (module.js:663:10)

    at Module.load (module.js:565:32)

    at tryModuleLoad (module.js:505:12)

    at Function.Module._load (module.js:497:3)

    at Function.Module.runMain (module.js:693:10)

    at startup (bootstrap_node.js:191:16)

    at bootstrap_node.js:612:3

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! webpack-vue@1.0.0 build: `webpack --config webpack.config.js`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the webpack-vue@1.0.0 build 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\issuser\AppData\Roaming\npm-cache\_logs\2018-06-08T03_23_22_529Z-debug.log


提问者:qq_明_72 2018-06-08 11:36

个回答

  • 码匠
    2018-08-16 09:42:27

    webpack4.x的可以看看这里

    https://blog.csdn.net/u012443286/article/details/79504289

  • 慕圣7255176
    2018-08-06 17:01:33

    请教一下,你的问题解决了吗?出现的同样的问题

  • 慕勒2507757
    2018-06-14 11:25:31

    我和你报的一样的错,下了一个webpack-cli  然后出来这个错误,你们怎么解决的呀

  • 媄玅亽甡
    2018-06-08 12:02:18

    请选择webpack-dev-server @2版本   

    提供 给你package.json

    {
      "name": "vue-build",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "dependencies": {
        "cross-env": "^5.1.6",
        "css-loader": "^0.28.11",
        "extract-text-webpack-plugin": "^3.0.2",
        "file-loader": "^1.1.11",
        "html-webpack-plugin": "^3.2.0",
        "less": "^3.0.4",
        "less-loader": "^4.1.0",
        "style-loader": "^0.21.0",
        "url-loader": "^1.0.1",
        "vue": "^2.5.16",
        "vue-loader": "^15.2.4",
        "vue-style-loader": "^4.1.0",
        "vue-template-compiler": "^2.5.16",
        "webpack": "^3.12.0",
        "webpack-dev-server": "^2.11.2"
      },
      "devDependencies": {},
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1",
        "build": "cross-env NODE_ENV=production webpack --config webpack.config.js",
        "dev": "cross-env NODE_ENV=developlment webpack-dev-server --config webpack.config.js"
      },
      "author": "",
      "license": "ISC"
    }