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

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

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

執行npm install   node

而後運行 npm run dev 時 出現了這個報錯。git

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

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

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

 

install以後執行npm run dev 又出現了新的問題koa

 

 

 

去查了資料(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)/})}

相關文章
相關標籤/搜索