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.

Ubuntu Server 20.04: oputil.js gives 'flat is not a function' error

See original GitHub issue

Describe the Bug Attempting to install using curl script, which appears to complete without issue. Unable to complete initial config due to ./oputil.js config new erroring out with

(node:319138) UnhandledPromiseRejectionWarning: TypeError: this.breakLines(...).flat is not a function

Will include full terminal output below

To Reproduce

Just run ./oputil.js config new after initial install. Tried npm rebuild with no effect.

Expected Behavior Expected prompts associated with first run configuration.

Actual Behavior

analytic@origin:~/enigma-bbs$ ./oputil.js config new
(node:319138) UnhandledPromiseRejectionWarning: TypeError: this.breakLines(...).flat is not a function
    at ScreenManager.forceLineReturn (/home/analytic/enigma-bbs/node_modules/inquirer/lib/utils/screen-manager.js:172:56)
    at ScreenManager.render (/home/analytic/enigma-bbs/node_modules/inquirer/lib/utils/screen-manager.js:81:20)
    at ConfirmPrompt.render (/home/analytic/enigma-bbs/node_modules/inquirer/lib/prompts/confirm.js:70:17)
    at ConfirmPrompt._run (/home/analytic/enigma-bbs/node_modules/inquirer/lib/prompts/confirm.js:51:10)
    at Promise (/home/analytic/enigma-bbs/node_modules/inquirer/lib/prompts/base.js:61:12)
    at new Promise (<anonymous>)
    at ConfirmPrompt.run (/home/analytic/enigma-bbs/node_modules/inquirer/lib/prompts/base.js:60:12)
    at defer (/home/analytic/enigma-bbs/node_modules/inquirer/lib/ui/prompt.js:105:30)
    at Observable._subscribe (/home/analytic/enigma-bbs/node_modules/rxjs/dist/cjs/internal/observable/defer.js:8:31)
    at Observable._trySubscribe (/home/analytic/enigma-bbs/node_modules/rxjs/dist/cjs/internal/Observable.js:41:25)
(node:319138) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:319138) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Tried updating to latest version of nodejs and seem to have made matters worse:

./oputil.js config new
internal/modules/cjs/loader.js:818
  throw err;
  ^

Error: Cannot find module '/home/analytic/enigma-bbs/node_modules/sqlite3/lib/binding/node-v72-linux-x64/node_sqlite3.node'
Require stack:
- /home/analytic/enigma-bbs/node_modules/sqlite3/lib/sqlite3-binding.js
- /home/analytic/enigma-bbs/node_modules/sqlite3/lib/sqlite3.js
- /home/analytic/enigma-bbs/core/database.js
- /home/analytic/enigma-bbs/core/oputil/oputil_common.js
- /home/analytic/enigma-bbs/core/oputil/oputil_main.js
- /home/analytic/enigma-bbs/oputil.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)                       
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)                                  
    at Module.require (internal/modules/cjs/loader.js:887:19)                                         
    at require (internal/modules/cjs/helpers.js:74:18)                                                
    at Object.<anonymous> (/home/analytic/enigma-bbs/node_modules/sqlite3/lib/sqlite3-binding.js:4:15)
    at Module._compile (internal/modules/cjs/loader.js:999:30)                                        
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)                         
    at Module.load (internal/modules/cjs/loader.js:863:32)                                            
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)                                  
    at Module.require (internal/modules/cjs/loader.js:887:19) {                                       
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/analytic/enigma-bbs/node_modules/sqlite3/lib/sqlite3-binding.js',                          
    '/home/analytic/enigma-bbs/node_modules/sqlite3/lib/sqlite3.js',                                  
    '/home/analytic/enigma-bbs/core/database.js',
    '/home/analytic/enigma-bbs/core/oputil/oputil_common.js',                                         
    '/home/analytic/enigma-bbs/core/oputil/oputil_main.js',                                           
    '/home/analytic/enigma-bbs/oputil.js'
  ]
}

Environment

  • I am using Node.js v12.x LTS or higher

  • npm install or yarn reports success

  • Actual Node.js version (node --version): 12.22.12

  • Operating system (uname -a on *nix systems): Linux origin 5.4.0-109-generic #123-Ubuntu SMP Fri Apr 8 09:10:54 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

  • Revision (git rev-parse --short HEAD): ac38ac9e

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
LilFonkycommented, May 12, 2022

Just started it up successfully. Thanks for seeing me over the finish line!

1reaction
LilFonkycommented, May 11, 2022

Re-ran npm rebuild and now it seems to be working. Will leave this thread up just in case someone else hits this snag…

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix "flat is not a function" JavaScript Error? - Designcise
If you're seeing the error " TypeError: flat is not a function ", then it could mean that: Method is not supported, or;...
Read more >
flat() is not a function, what's wrong? - Stack Overflow
The flat method is not yet implemented in common browsers (only Chrome v69, Firefox Nightly and Opera 56). It's an experimental feature.
Read more >
TypeError: flat is not a function in JavaScript [Solved]
The "TypeError: flat is not a function" occurs for multiple reasons: Using the flat method in a browser that doesn't support it.
Read more >
"flat is not a function" error #57 - digitalbazaar/vc-js - GitHub
Hello, I'm trying to verify a presentation but get this error in the console. ... vc-js code call a flat() function before it...
Read more >
npm http-server not working on ubuntu 20.04.3 LTS
Today I installed http-server on ubuntu and it does not work. It initializes exactly as it does on Windows. However, I get an...
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