yeoman / environment

Yeoman runtime environment
BSD 2-Clause "Simplified" License
128 stars 70 forks source link

Broken dateformat.js ESM import #326

Closed csvan closed 3 years ago

csvan commented 3 years ago

We have started seeing this as of this morning, possibly a broken upstream change:

[36mhost_1  | [1] [0] /workdir/node_modules/yeoman-environment/lib/util/binary-diff.js:4
[36mhost_1  | [1] [0] const dateFormat = require('dateformat');
[36mhost_1  | [1] [0]                    ^
[36mhost_1  | [1] [0]
[36mhost_1  | [1] [0] Error [ERR_REQUIRE_ESM]: require() of ES Module /workdir/node_modules/yeoman-environment/node_modules/dateformat/lib/dateformat.js from /workdir/node_modules/yeoman-environment/lib/util/binary-diff.js not supported.
[36mhost_1  | [1] [0] Instead change the require of dateformat.js in /workdir/node_modules/yeoman-environment/lib/util/binary-diff.js to a dynamic import() which is available in all CommonJS modules.
[36mhost_1  | [1] [0]     at Object. (/workdir/node_modules/yeoman-environment/lib/util/binary-diff.js:4:20)
[36mhost_1  | [1] [0]     at Object. (/workdir/node_modules/yeoman-environment/lib/util/conflicter.js:8:20)
[36mhost_1  | [1] [0]     at Object. (/workdir/node_modules/yeoman-environment/lib/environment.js:28:20)
[36mhost_1  | [1] [0]     at Object. (/workdir/node_modules/@ccsdk/scripts/src/index.js:9:16)
[36mhost_1  | [1] [0]     at Object. (/workdir/node_modules/@ccsdk/scripts/src/bin/index.js:4:1) {
[36mhost_1  | [1] [0]   code: 'ERR_REQUIRE_ESM'
[36mhost_1  | [1] [0] }
chase-manning commented 3 years ago

@csvan Fixed in version 4.6.3 of dateformat package: https://www.npmjs.com/package/dateformat

cyril-nmpro commented 10 months ago

Is this back in 5.0.3 now?

HT-35 commented 2 weeks ago

i try used npm i --save-dev npm i dateformat@4.6.3, i fixed error