Nuxt.js: Error: Plugin/Preset files are not allowed to export objects, only functions.

Created on 1 Nov 2018  ·  7Comments  ·  Source: nuxt/nuxt.js

package.json:
{
"name": "nuxtTest",
"version": "1.0.0",
"description": "My test Nuxt.js project",
"author": "test",
"private": true,
"scripts": {
"dev": "cross-env NODE_ENV=development nodemon server/index.js --watch server",
"build": "nuxt build",
"start": "cross-env NODE_ENV=production node server/index.js",
"generate": "nuxt generate",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
"precommit": "npm run lint"
},
"dependencies": {
"cross-env": "^5.2.0",
"nuxt": "^2.0.0",
"koa": "^2.5.2",
"@nuxtjs/axios": "^5.0.0"
},
"devDependencies": {
"babel-eslint": "^8.2.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.7.0",
"babel-preset-stage-2": "^6.24.1",
"eslint": "^5.0.1",
"eslint-config-prettier": "^3.1.0",
"eslint-loader": "^2.0.0",
"eslint-plugin-prettier": "2.6.2",
"eslint-plugin-vue": "^4.0.0",
"nodemon": "^1.11.0",
"prettier": "1.14.3"
}
}

nuxtconfig:
const pkg = require('./package')

module.exports = {
mode: 'universal',

/*
** Headers of the page
*/
head: {
title: pkg.name,
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: pkg.description }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
},

/*
** Customize the progress-bar color
*/
loading: false,

/*
** Global CSS
*/
css: [
],

/*
** Plugins to load before mounting the App
*/
plugins: [
],

/*
* Nuxt.js modules
*/
modules: [
// Doc: https://github.com/nuxt-community/axios-module#usage
'@nuxtjs/axios'
],
/

** Axios module configuration
*/
axios: {
// See https://github.com/nuxt-community/axios-module#options
},

/*
* Build configuration
*/
build: {
babel: {
presets: [
[
"env",
{
modules: false,
targets: {
browsers: ["> 1%", "last 2 versions", "not ie <= 8"]
}
}
],
"stage-2"
],
plugins: ["transform-runtime"]
},
/

** You can extend webpack config here
*/
extend(config, ctx) {
// Run ESLint on save
if (ctx.isDev && ctx.isClient) {
config.module.rules.push({
enforce: 'pre',
test: /.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/
})
}
}
}
}

image

This question is available on Nuxt community (#c8070)

Most helpful comment

I have same issue

All 7 comments

This issue as been imported as question since it does not respect nuxt.js issue template. Only bug reports and feature requests stays open to reduce maintainers workload.
If your issue is not a question, please mention the repo admin or moderator to change its type and it will be re-opened automatically.
Your question is available at https://cmty.app/nuxt/nuxt.js/issues/c8070.

i also hava the problem

how to resolve

好像版本不兼容

how to resolve this problem

you can have a try
npm install [email protected] --save-dev

I have same issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pehbehbeh picture pehbehbeh  ·  3Comments

surmon-china picture surmon-china  ·  3Comments

bimohxh picture bimohxh  ·  3Comments

msudgh picture msudgh  ·  3Comments

shyamchandranmec picture shyamchandranmec  ·  3Comments