Gulp task "copy-cesium-assets" fails in node v12.17.0+
steve9164 opened this issue · comments
Stephen Davies commented
The error is caused by a change in how node deals with ESM modules. In v12.17.0+ node interprets the exports
object in package.json
as a complete list of exports for the "terriajs-cesium" package and will fail when other paths are used in a require
or import
. This trips up our gulp tasks which use require.resolve("terriajs-cesium/package.json")
to determine the location of the "terriajs-cesium" package for copying assets etc.
[09:08:28] Starting 'copy-cesium-assets'...
[09:08:28] 'copy-cesium-assets' errored after 2.57 ms
[09:08:28] Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in C:\Users\Owner\TerriaMap\node_modules\terriajs-cesium\package.json
at applyExports (internal/modules/cjs/loader.js:491:9)
at resolveExports (internal/modules/cjs/loader.js:507:23)
at Function.Module._findPath (internal/modules/cjs/loader.js:635:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:953:27)
at Function.resolve (internal/modules/cjs/helpers.js:78:19)
at C:\Users\Owner\TerriaMap\node_modules\terriajs\gulpfile.js:78:33
at copy-cesium-assets (C:\Users\Owner\TerriaMap\node_modules\undertaker\lib\set-task.js:13:15)
at bound (domain.js:426:14)
at runBound (domain.js:439:12)
at asyncRunner (C:\Users\Owner\TerriaMap\node_modules\async-done\index.js:55:18)
To fix this problem:
- Merge TerriaJS/cesium#73
- Release "terriajs-cesium"
- Release terriajs
master
pointing to new package version - Update TerriaMap
master
- Release terriajs
next
pointing to new package version (blocked on #4386) - Update TerriaMap
next