亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

npm run build出現報錯,解決方法

webpack 4.0以上 ,npm run build出現報錯解決方法


正在回答

7 回答

還是不行

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

> [email protected] 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 [email protected] No description

npm WARN [email protected] No repository field.

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})


+ [email protected]

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! [email protected] build: `webpack --mode development`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the [email protected] 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 回復 有任何疑惑可以回復我~

1,修改package.json中代碼

將老師編輯的?

"build": "webpack --config webpack.config.js"

修改為

"build": "webpack --mode development"

2,修改webpack.config.js中代碼

頂部添加

const {

VueLoaderPlugin

} = require('vue-loader');

將【module】中新增【css】以及末尾添加【plugins】

修改為:

module: {

rules: [{

test: /.vue$/,

loader: 'vue-loader'

}, {

test: /.css$/,

use: ['vue-style-loader', 'css-loader']

}]

},

plugins: [

new VueLoaderPlugin()

]


13 回復 有任何疑惑可以回復我~
#1

wason

修改之后報loaderContext.emitError is not a function
2018-06-30 回復 有任何疑惑可以回復我~
#2

weibo_姚望微晨_0 回復 wason

報一樣的錯誤,請問解決了嗎?
2018-07-04 回復 有任何疑惑可以回復我~
#3

qq_情融化了雪_0

可以,靠譜
2018-07-16 回復 有任何疑惑可以回復我~
#4

YeeTodd 回復 weibo_姚望微晨_0

同問啊
2018-07-16 回復 有任何疑惑可以回復我~
#5

慕斯卡拉

厲害,解決了
2018-07-20 回復 有任何疑惑可以回復我~
#6

40huo

解決了,靠譜。
2018-07-25 回復 有任何疑惑可以回復我~
#7

Terence_Jing 回復 wason

里面有一個假線程報錯了錯誤,我也遇到了,很是苦惱,還沒解決
2018-07-28 回復 有任何疑惑可以回復我~
#8

iOS_侯陽陽

謝謝你,我問題解決了
2019-03-04 回復 有任何疑惑可以回復我~
查看5條回復

舉報

0/150
提交
取消
Vue+Webpack打造todo應用
  • 參與學習       84618    人
  • 解答問題       812    個

用前端最熱門框架Vue+最火打包工具Webpack打造todo應用

進入課程

npm run build出現報錯,解決方法

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號