Skip to content

Express.js Starter: "u.toSorted is not a function" error on npm install #1872

@ghost

Description

Describe the bug

When trying to run the default Express.js starter project, the npm install command fails with the error npm error u.toSorted is not a function. This prevents the project from booting and running successfully. It appears the underlying Node.js environment or a dependency is attempting to use the Array.prototype.toSorted() method, which is an ECMAScript 2023 feature, but the WebContainer's Node.js version might be older and not support it.

Link to the blitz that caused the error

https://stackblitz.com/edit/stackblitz-starters-fvhsvqj7?description=&file=README.md&title=Express%20Starter

Steps to reproduce

  1. Go to 'https://stackblitz.com/edit/stackblitz-starters-fvhsvqj7?description=&file=README.md&title=Express%20Starter'
  2. Wait for the project to attempt to install dependencies.
  3. Observe the error npm error u.toSorted is not a function in the terminal.
  4. The project fails to boot and run.

Expected behavior

The Express.js starter project should successfully install all dependencies and boot up, allowing the server to run without errors. The expected behavior is for the npm install command to complete successfully, followed by the server starting as indicated by Running start command.

Parity with Local

Screenshots

Image

Platform

Browser name  = Chrome
Full version  = 109.0.0.0
Major version = 109
navigator.appName = Netscape
navigator.userAgent = Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36
performance.memory = {
  "totalJSHeapSize": 157804385,
  "usedJSHeapSize": 138192889,
  "jsHeapSizeLimit": 2172649472
}
Hash = 4d9fd228

Additional context

This error suggests a discrepancy between the Node.js version running in the WebContainer for this starter and the JavaScript language features being used by its dependencies. The toSorted() method is an ES2023 feature, implying the current Node.js runtime might be too old to support it. Please ensure the Node.js version in the WebContainer for this starter is up-to-date or that the dependencies are compatible with the existing environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions