Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Object.fromEntries is not a function when deploying in Netlify #48

Closed
SahilMaharaj opened this issue Jul 11, 2020 · 4 comments
Closed

Comments

@SahilMaharaj
Copy link

Hi there,

All works fine on my local but when deploying I get the following:

TypeError: Object.fromEntries is not a function
at collectionStore.data.map.node (/opt/build/repo/node_modules/gridsome-plugin-flexsearch/gridsome.server.js:72:26)
at Array.map ()
at getStoreCollection (/opt/build/repo/node_modules/gridsome-plugin-flexsearch/gridsome.server.js:56:35)
at collection (/opt/build/repo/node_modules/gridsome-plugin-flexsearch/gridsome.server.js:122:14)
at /opt/build/repo/node_modules/gridsome-plugin-flexsearch/node_modules/p-map/index.js:57:28

Any help would be much appreciated :)

@SahilMaharaj
Copy link
Author

SahilMaharaj commented Jul 11, 2020

My gridsome.config.js

module.exports = {
  siteName: 'Gridsome',
  plugins: [
    {
      use: '@gridsome/vue-remark',
      options: {
        typeName: 'Cities', // Required
        baseDir: './cities', // Where .md files are located
        pathPrefix: '/cities', // Add route prefix. Optional
        template: './src/templates/Cities.vue', // Optional
      }
    },
    {
      use: '@gridsome/vue-remark',
      options: {
        typeName: 'Organisations', // Required
        baseDir: './organisations', // Where .md files are located
        refs: {
          locations: {
            typeName: 'Locations',
            create: true
          }
        },
        pathPrefix: '/organisations', // Add route prefix. Optional
        template: './src/templates/Organisations.vue', // Optional
      }
    },
    {
      use: 'gridsome-plugin-flexsearch',
      options: {
        searchFields: ['title', 'desc'],
        collections: [
          {
            typeName: 'Cities',
            indexName: 'Cities',
            fields: ['title', 'desc']
          },
          {
            typeName: 'Organisations',
            indexName: 'Organisations',
            fields: ['title', 'desc']
          }
        ]      
      }
    }
  ]
}

@travis-r6s
Copy link
Owner

travis-r6s commented Jul 11, 2020

This plugin requires at least Node version 12 - if you are using a version below that, then Object.fromEntries will be undefined.

Could you try upgrading Node, and see if that works?

@travis-r6s
Copy link
Owner

Sorry, just saw you said it was showing that on deploy - you will need to set the node version in the build environment, for example adding a NODE_VERSION env on Netlify.

@SahilMaharaj
Copy link
Author

That did the trick, thanks mate!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants