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

npm run build出现报错,解决方法

webpack 4.0以上 ,npm run build出现报错解决方法


提问者:慕仔7065256 2018-06-28 09:47

个回答

  • Bridy
    2018-12-12 17:48:23

    还是不行

  • 慕圣7255176
    2018-08-06 16:54:17

    > shizhan-vue@1.0.0 build E:\web前段\shizhan-vue

    > webpack --mode development


    One CLI for webpack must be installed. These are recommended choices, delivered as separate packages:

     - webpack-cli (https://github.com/webpack/webpack-cli)

       The original webpack full-featured CLI.

     - webpack-command (https://github.com/webpack-contrib/webpack-command)

       A lightweight, opinionated webpack CLI.

    We will use "npm" to install the CLI via "npm install -D".

    Which one do you like to install (webpack-cli/webpack-command):



    按照大神的方法出现了这个问题,是什么原因怎么破?我试着安装了webpack-cli后报以下错误


    Installing 'webpack-cli' (running 'npm install -D webpack-cli')...

    npm WARN shizhan-vue@1.0.0 No description

    npm WARN shizhan-vue@1.0.0 No repository field.

    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):

    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})


    + webpack-cli@3.1.0

    added 76 packages in 54.02s

    TypeError: path.jion is not a function

        at Object.<anonymous> (E:\web前段\shizhan-vue\webpack.config.js:6:12)

        at Module._compile (E:\web前段\shizhan-vue\node_modules\v8-compile-cache\v8-compile-cache.js:178: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 (E:\web前段\shizhan-vue\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)

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

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

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

        at Array.forEach (<anonymous>)

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

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

        at Object.parse (E:\web前段\shizhan-vue\node_modules\yargs\yargs.js:563:18)

        at E:\web前段\shizhan-vue\node_modules\webpack-cli\bin\cli.js:219:8

        at Object.<anonymous> (E:\web前段\shizhan-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 runCommand.then (E:\web前段\shizhan-vue\node_modules\webpack\bin\webpack.js:152:5)

        at <anonymous>

        at process._tickCallback (internal/process/next_tick.js:188:7)

    npm ERR! code ELIFECYCLE

    npm ERR! errno 1

    npm ERR! shizhan-vue@1.0.0 build: `webpack --mode development`

    npm ERR! Exit status 1

    npm ERR!

    npm ERR! Failed at the shizhan-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\小陆\AppData\Roaming\npm-cache\_logs\2018-08-06T08_48_54_669Z-debug.log


  • 我想笑
    2018-07-26 11:19:00

    厉害了,问题已经解决

  • 一只小学渣123
    2018-07-20 15:36:01

    可以,已解决

  • 一模拉仨
    2018-07-12 20:42:56

    这个可以,已解决。

    是webpack升级到4以后的问题

  • waat
    2018-07-10 15:25:53

    可以,解决了