在安装NuxtJS的时候出现的问题

2019-11-28  本文已影响0人  夏风丁字裤

转载至:https://t00ts.com/257.htm

初次运行nuxt.js时会出现两个问题

问题一:

ERROR Failed to compile with 1 errors 12:46:40 PM

error in./server/index.js

Module build failed:Error:Plugin/Preset files are not allowed to export objects,only functions.In /Users/Desktop/project/koa2/nuxt/nuxt-learn/node_modules/backpack-core/babel.js

at createDescriptor (/Users/Desktop/project/koa2/nuxt/nuxt-learn/node_modules/@babel/core/lib/config/config-descriptors.js:178:11)

at items.map (/Users/Desktop/project/koa2/nuxt/nuxt-learn/node_modules/@babel/core/lib/config/config-descriptors.js:109:50)

at Array.map ()

at createDescriptors (/Users//Desktop/project/koa2/nuxt/nuxt-learn/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)

at createPresetDescriptors (/Users//Desktop/project/koa2/nuxt/nuxt-learn/node_modules/@babel/core/lib/config/config-descriptors.js:101:10)

at passPerPreset (/Users/Desktop/project/koa2/nuxt/nuxt-learn/node_modules/@babel/core/lib/config/config-descriptors.js:58:96)

at cachedFunction (/Users/Desktop/project/koa2/nuxt/nuxt-learn/node_modules/@babel/core/lib/config/caching.js:33:19)

at presets.presets (/Users/Desktop/project/koa2/nuxt/nuxt-learn/node_modules/@babel/core/lib/config/config-descriptors.js:29:84)

at mergeChainOpts (/Users/Desktop/project/koa2/nuxt/nuxt-learn/node_modules/@babel/core/lib/config/config-chain.js:320:26)

at /Users//Desktop/project/koa2/nuxt/nuxt-learn/node_modules/@babel/core/lib/config/config-chain.js:283:7

internal/modules/cjs/loader.js:638

throw err;

^

Error:Cannot find module ‘/Users/Desktop/project/koa2/nuxt/nuxt-learn/build/main.js’

at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)

at Function.Module._load (internal/modules/cjs/loader.js:562:25)

at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)

at startup (internal/bootstrap/node.js:283:19)

at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

解决方案:

    1     npm uninstall--save babel-loadernpm uninstall--save @babel/core

    2     npm install--save-dev babel-loader@^7

问题二:

ERROR Failed to compilewith1errors friendly-errors12:48:29Module buildfailed(from./node_modules/eslint-loader/index.js):friendly-errors12:48:29TypeError:Cannot read property'eslint'ofundefinedat Object.module.exports(/Users/dingyang/Desktop/project/koa2/nuxt/nuxt-learn/node_modules/eslint-loader/index.js:148:18)friendly-errors12:48:29You may use special comments to disable some warnings.friendly-errors12:48:29Use// eslint-disable-next-line to ignore the next line. friendly-errors 12:48:29Use /* eslint-disable */to ignore all warningsina file.

解决方案:

1     npm install eslint-loader@2.1.2 --save-dev

最后再次执行就没问题了。   

上一篇下一篇

猜你喜欢

热点阅读