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.

Node 10 - assets.flatMap is not a function

See original GitHub issue

🐛 bug report

Parcel 2 does not work on Node 10 anymore

Building SimpleTable.tsx...
Error: assets.flatMap is not a function
× Build failed.
TypeError: assets.flatMap is not a function
    at Transformation.runPipelines (D:\a\solid-simple-table\solid-simple-table\node_modules\@parcel\core\lib\Transformation.js:368:131)

🎛 Configuration (.babelrc, package.json, cli command)

Everything is available here: https://github.com/aminya/solid-simple-table

  "targets": {
    "main": {
      "context": "browser",
      "engines": {
        "browsers": "> 0.25%"
      },
      "includeNodeModules": true,
      "isLibrary": true
    },
    "module": {
      "context": "browser",
      "engines": {
        "browsers": "Chrome 76"
      },
      "includeNodeModules": false,
      "isLibrary": true
    },
}

babel

{
  "presets": ["babel-preset-solid", "@babel/preset-typescript", "@parcel/babel-preset-env"],
  "plugins": ["@parcel/babel-plugin-transform-runtime"]
}

🤔 Expected Behavior

Node 10 should work like other versions

😯 Current Behavior

It does not work

💁 Possible Solution

🔦 Context

💻 Code Sample

https://github.com/aminya/solid-simple-table

🌍 Your Environment

Software Version(s)
Parcel ^2.0.0-nightly.489
Node 10
npm/Yarn 6
Operating System Win 10

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

3reactions
mischniccommented, Jan 3, 2021

We have dropped Node 10 support because it’s a maintenance LTS version already.

Didn’t you get a warning from npm? We do specify "engines": {"node": ">= 12.0.0"}: https://unpkg.com/browse/@parcel/core@2.0.0-nightly.500/package.json

0reactions
aminyacommented, Jan 6, 2021

I wrote a custom script to install and build the project using Parcel 1, 2-beta or 2-nightly based on the Node version.

const child_process = require('child_process');
const path = require('path')

const NodeVersion = parseFloat(process.version.match(/^v(\d+\.\d+)/)[1])

if ( NodeVersion < 10) {
  child_process.execSync(`npm install parcel@1`, {stdio: 'inherit'})
  child_process.execSync(`node ${path.resolve('./node_modules/parcel/dist/bin/parcel')} parcel build --target main --target types --target module --experimental-scope-hoisting src/SimpleTable.tsx`, {stdio: 'inherit'})
} 
else if (NodeVersion < 12) {
  child_process.execSync(`npm install parcel@2.0.0-beta.1`, {stdio: 'inherit'})
  child_process.execSync(`node ${path.resolve('./node_modules/parcel/dist/bin/parcel')} parcel build --target main --target types --target module src/SimpleTable.tsx`, {stdio: 'inherit'})
} else {
  child_process.execSync(`node ${path.resolve('./node_modules/parcel/dist/bin/parcel')} parcel build --target main --target types --target module src/SimpleTable.tsx`, {stdio: 'inherit'})
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Anyone knows how to solve npm start error - Stack Overflow
flatMap is not a function TypeError: assets.flatMap is not a function at Transformation.runPipelines (/home/XXX/code/XXX/javascript-notes/ ...
Read more >
TypeError: flatMap is not a function in JavaScript | bobbyhadz
To solve the "flatMap is not a function" error, make sure to only call the flatMap method on arrays and in browsers that...
Read more >
Object.entries(...).flatMap is not a function - Support
entries(...). flatMap is not a function. Since then I have always been getting the same error, any idea what it could be or...
Read more >
flatMap method over array - (flatMap is not a function)-node.js
It means you're using a web browser or other development environment that does not support Array.prototype.flatMap (currently Edge and IE have no support)....
Read more >
Array.prototype.flatMap() - JavaScript - MDN Web Docs
The flatMap() method reads the length property of this and then accesses each integer index. If the return value of the callback function...
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