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

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

npm run build 報錯 請問是哪里的問題

> [email protected] build E:\workspace\整理文件web\綜合練習\vue\vue核心技術\VUE-SSR-TECH
> webpack --config webpack.config.js

Hash: 96a4b1c95b2729429677
Version: webpack 4.35.3
Time: 480ms
Built at: 2019-07-12 16:36:36
?1 asset
Entrypoint main = bundle.js
[0] (webpack)/buildin/global.js 472 bytes {0} [built]
[2] ./src/index.js 186 bytes {0} [built]
[3] ./src/app.vue 426 bytes {0} [built] [failed] [3 errors]
??? + 4 hidden modules

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/

ERROR in ./src/app.vue
Module Error (from ./node_modules/vue-loader/lib/index.js):
[vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
?@ ./src/index.js 2:0-27

ERROR in ./src/app.vue
Module Error (from ./node_modules/vue-loader/lib/index.js):
vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config.
?@ ./src/index.js 2:0-27

ERROR in ./src/app.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
TypeError: Cannot read property 'parseComponent' of undefined
??? at parse (E:\workspace\整理文件web\綜合練習\vue\vue核心技術\VUE-SSR-TECH\node_modules\@vue\component-compiler-utils\dist\parse.js:14:23)
??? at Object.module.exports (E:\workspace\整理文件web\綜合練習\vue\vue核心技術\VUE-SSR-TECH\node_modules\vue-loader\lib\index.js:67:22)
?@ ./src/index.js 2:0-27
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `webpack --config webpack.config.js`
npm ERR! Exit status 2
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\Administrator\AppData\Roaming\npm-cache\_logs\2019-07-12T08_36_36_666Z-debug.log
PS E:\workspace\整理文件web\綜合練習\vue\vue核心技術\VUE-SSR-TECH> npm run build

> [email protected] build E:\workspace\整理文件web\綜合練習\vue\vue核心技術\VUE-SSR-TECH
> webpack --config webpack.config.js

Hash: 96a4b1c95b2729429677
Version: webpack 4.35.3
Time: 508ms
Built at: 2019-07-12 16:38:41
?1 asset
Entrypoint main = bundle.js
[0] (webpack)/buildin/global.js 472 bytes {0} [built]
[2] ./src/index.js 186 bytes {0} [built]
[3] ./src/app.vue 426 bytes {0} [built] [failed] [3 errors]
??? + 4 hidden modules

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/

ERROR in ./src/app.vue
Module Error (from ./node_modules/vue-loader/lib/index.js):
[vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
?@ ./src/index.js 2:0-27

ERROR in ./src/app.vue
Module Error (from ./node_modules/vue-loader/lib/index.js):
vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config.
?@ ./src/index.js 2:0-27

ERROR in ./src/app.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
TypeError: Cannot read property 'parseComponent' of undefined
??? at parse (E:\workspace\整理文件web\綜合練習\vue\vue核心技術\VUE-SSR-TECH\node_modules\@vue\component-compiler-utils\dist\parse.js:14:23)
??? at Object.module.exports (E:\workspace\整理文件web\綜合練習\vue\vue核心技術\VUE-SSR-TECH\node_modules\vue-loader\lib\index.js:67:22)
?@ ./src/index.js 2:0-27
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `webpack --config webpack.config.js`
npm ERR! Exit status 2
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\Administrator\AppData\Roaming\npm-cache\_logs\2019-07-12T08_38_41_819Z-debug.log

----------------------------------------------------------------------------------------------------------------------------

webpack.json.js文件:

const path = require('path')

module.exports = {

? ?entry:path.join(__dirname,'src/index.js'),

? ?output:{

? ? ? ?filename:'bundle.js',

? ? ? ?path:path.join(__dirname,'dist')

? ?},

? ?module:{

? ? ? ?rules:[

? ? ? ? ? ?{

? ? ? ? ? ? ? ?test: /.vue$/,

? ? ? ? ? ? ? ?loader: 'vue-loader'

? ? ? ? ? ?}

? ? ? ?]

? ?}

}

-------------------------------------------------------------------------------------------------

package.json文件:

{

?"name": "vue-ssr-tech",

?"version": "1.0.0",

?"main": "index.js",

?"scripts": {

? ?"dev": "webpack --mode development",

? ?"test": "echo \"Error: no test specified\" && exit 1",

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

?},

?"author": "",

?"license": "ISC",

?"dependencies": {

? ?"css-loader": "^3.0.0",

? ?"vue": "^2.6.10",

? ?"vue-loader": "^15.7.0",

? ?"webpack": "^4.35.3"

?},

?"devDependencies": {

? ?"webpack-cli": "^3.3.5"

?},

?"description": ""

}


正在回答

2 回答

錯誤提示你的包依賴沒有裝好

你可以參考一下我的代碼https://github.com/carrieguo/vue.js-learn


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

ERROR in ./src/app.vue
Module Error (from ./node_modules/vue-loader/lib/index.js):
[vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.

沒有安裝?vue-template-compiler 模塊, 在vs-code里打開終端,確保是在當前項目,執行 npm run?vue-template-compiler.(一定要在當前項目打開終端, 之前老用cmd打開安裝,老是找不到模塊)

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

舉報

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

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

進入課程

npm run build 報錯 請問是哪里的問題

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

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

幫助反饋 APP下載

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

公眾號

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