question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Object.values is not a function during Exporting Routes on build

See original GitHub issue

I’m building from the sass template with my config file:

import ExtractTextPlugin from 'extract-text-webpack-plugin'

export default {
  getRoutes: async () => {
    return [
      {
        path: '/',
        component: 'src/containers/Home',
      },
//+ other routes

and App,js has the basic example for routing:

import React from 'react'
import { Router } from 'react-static'
import Routes from 'react-static-routes'

import './app.scss'

export default () => (
  <Router>
    <Routes />
  </Router>
);

dev server from localhost works well but this error shows up on build:

=> [✓] App Bundled: 31475.245ms
=> Exporting Routes...
TypeError: Object.values is not a function
    at _callee$ (C:\Users\John\Documents\Projects\test-site\node_modules\react-static\lib\static.js:177:32)
    at tryCatch (C:\Users\John\Documents\Projects\test-site\node_modules\regenerator-runtime\runtime.js:62:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\John\Documents\Projects\test-site\node_modules\regenerator-runtime
\runtime.js:296:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\John\Documents\Projects\test-site\node_module
s\regenerator-runtime\runtime.js:114:21)
    at step (C:\Users\John\Documents\Projects\test-site\node_modules\react-static\lib\static.js:120:191)
    at C:\Users\John\Documents\Projects\test-site\node_modules\react-static\lib\static.js:120:437
    at C:\Users\John\Documents\Projects\test-site\node_modules\react-static\lib\static.js:120:99
    at C:\Users\John\Documents\Projects\test-site\node_modules\react-static\lib\static.js:205:30
    at Array.map (native)
    at _callee4$ (C:\Users\John\Documents\Projects\test-site\node_modules\react-static\lib\static.js:149:46)
    at tryCatch (C:\Users\John\Documents\Projects\test-site\node_modules\regenerator-runtime\runtime.js:62:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\John\Documents\Projects\test-site\node_modules\regenerator-runtime
\runtime.js:296:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\John\Documents\Projects\test-site\node_module
s\regenerator-runtime\runtime.js:114:21)
    at step (C:\Users\John\Documents\Projects\test-site\node_modules\react-static\lib\static.js:120:191)
    at C:\Users\John\Documents\Projects\test-site\node_modules\react-static\lib\static.js:120:361

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
atfzlcommented, Dec 21, 2017

I also faced this problem. It was because I was using node 6 which does not support Object.values, see Object.values node support. It is safe to use with node version >= 7.5.0

@tannerlinsley we should add engines key in package.json of react-static.

"engines" : { "node" : ">=7.5.0" }
1reaction
tannerlinsleycommented, Dec 21, 2017

NM, I got it in the next release. 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Object.values is not a function JavaScript
I obtain an array of countries. Now when I try to create an array from the values... var labels = Object.values(countries);.
Read more >
Error TypeError Object values is not a function - Edureka
I have seen that Object.values() is not supported in all browsers. But I am using the function in Node.js on server side -...
Read more >
Express Tutorial Part 4: Routes and controllers - MDN Web Docs
In this tutorial we'll set up routes (URL handling code) with "dummy" handler ... Last of all the module exports the Router object....
Read more >
How to solve the "is not a function" error in JavaScript
js we use require() to load external modules and files. This can cause, in some cases, an error like this: TypeError: require(...) is...
Read more >
Node.js v19.3.0 Documentation
Function arguments; Callbacks; Object factory; Function factory; Wrapping C++ objects ... Use of the feature is not recommended in production environments.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found