解決vue init nuxt-community/koa-template項目,安裝報錯問題


最近開始學習一個全棧做美團網站的項目。配置開發環境時遇到了以下問題。

在  vue init nuxt-community/koa-template nuxt-learn后

執行npm install   

然后運行 npm run dev 時 出現了這個報錯。

module build failed: Error: Plugin/Preset files are not allowed to export objects, only function.
In node_modules\backpack-core\babel.js

查了很久的資料(https://github.com/nuxt/nuxt.js/issues/4249) ,好像是因為 babel版本兼容的問題  解決辦法是升級backpack-core@0.3.0到backpack-core@0.7.0

npm install backpack-core@0.7.0 --save-dev

 

install之后執行npm run dev 又出現了新的問題

 

 

 

去查了資料(https://www.blyoo.com/3260.html)

 

nuxt.config.js里找到eslint-loader將ctx.isClient改成ctx.Client就可以運行了。

 

extend (config, ctx) {

if (ctx.Client&&ctx.isDev) {
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/
})
}

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM