Skip to content

Error using cesium in Node 12 or 13 #8452

@lilleyse

Description

@lilleyse

The cesium node module does not work in Node 13 due to the upgrade to ES6 modules and a breaking change in Node. The error message looks something like:

Warning: require() of ES modules is not supported.
require() of /Users/tylerlindberg/repos/forks/gltf-pipeline/node_modules/cesium/index.js from /Users/tylerlindberg/repos/forks/gltf-pipeline/gulpfile.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/tylerlindberg/repos/forks/gltf-pipeline/node_modules/cesium/package.json.

We've seen this issue in obj2gltf and gltf-pipeline:

CesiumGS/gltf-pipeline#507
CesiumGS/obj2gltf#225

@mramato has some ideas for fixing this before the Jan 2 release.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions