为了账号安全,请及时绑定邮箱和手机立即绑定

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

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


正在回答

7 回答

还是不行

0 回复 有任何疑惑可以回复我~

> 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


0 回复 有任何疑惑可以回复我~
#1

qq_天凉好个秋_14

我也出现这个问题,请问怎么解决?
2019-02-09 回复 有任何疑惑可以回复我~
#2

幕布斯6436195 回复 qq_天凉好个秋_14

对啊,一样的。我也是啊
2019-04-26 回复 有任何疑惑可以回复我~
#3

qianjunyifa

问题原因:node运行内存不足出现崩溃! 方法1:node.js版本过低,将node升级到最高版本。升级方法可根据自己系统自行百度; 方法2:package.json文件,将scripts:里的"build": "node build/build.js",更换成"build": "node -max_old_space_size=4096 build/build.js";()
2020-03-17 回复 有任何疑惑可以回复我~

厉害了,问题已经解决

0 回复 有任何疑惑可以回复我~

可以,已解决

0 回复 有任何疑惑可以回复我~

这个可以,已解决。

是webpack升级到4以后的问题

0 回复 有任何疑惑可以回复我~

可以,解决了

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
Vue+Webpack打造todo应用
  • 参与学习       84611    人
  • 解答问题       786    个

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

进入课程

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

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信