Skip to content

Instantly share code, notes, and snippets.

@ryanmr
Last active June 10, 2023 02:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanmr/8a84e05b6fd7d0df2a7724767d171b11 to your computer and use it in GitHub Desktop.
Save ryanmr/8a84e05b6fd7d0df2a7724767d171b11 to your computer and use it in GitHub Desktop.
# https://www.npmjs.com/package/string-width 87,290,385 weekly downloads
# vs
# https://www.npmjs.com/package/string-width-cjs 64 weekly downloads
// ... options for db, logging, etc
return unleash.start(unleashOptions).then(() => {
logger.info(`unleash is ready πŸŽ‰`);
});
➜ unleash git:(main) yarn
yarn install v1.22.19
[1/4] πŸ” Resolving packages...
[2/4] 🚚 Fetching packages...
warning Pattern ["strip-ansi@^6.0.1"] is trying to unpack in the same destination "/Users/ryan/Library/Caches/Yarn/v6/npm-strip-ansi-cjs-6.0.1-9e26c63d30f53443e9489495b2105d37b67a85d9-integrity/node_modules/strip-ansi-cjs" as pattern ["strip-ansi@^6.0.0"]. This could result in non-deterministic behavior, skipping.
warning Pattern ["string-width-cjs@npm:string-width@^4.2.0"] is trying to unpack in the same destination "/Users/ryan/Library/Caches/Yarn/v6/npm-string-width-cjs-4.2.3-269c7117d27b05ad2e536830a8ec895ef9c6d010-integrity/node_modules/string-width-cjs" as pattern ["string-width@^4.2.0"]. This could result in non-deterministic behavior, skipping.
warning Pattern ["strip-ansi-cjs@npm:strip-ansi@^6.0.1"] is trying to unpack in the same destination "/Users/ryan/Library/Caches/Yarn/v6/npm-strip-ansi-cjs-6.0.1-9e26c63d30f53443e9489495b2105d37b67a85d9-integrity/node_modules/strip-ansi-cjs" as pattern ["strip-ansi@^6.0.0"]. This could result in non-deterministic behavior, skipping.
warning Pattern ["string-width@^4.1.0"] is trying to unpack in the same destination "/Users/ryan/Library/Caches/Yarn/v6/npm-string-width-cjs-4.2.3-269c7117d27b05ad2e536830a8ec895ef9c6d010-integrity/node_modules/string-width-cjs" as pattern ["string-width@^4.2.0"]. This could result in non-deterministic behavior, skipping.
[3/4] πŸ”— Linking dependencies...
[4/4] πŸ”¨ Building fresh packages...
[1/3] ⠐ cpu-features
[-/3] ⠐ waiting...
// 5.1.7
➜ unleash git:(main) yarn start:local
yarn run v1.22.19
$ node -r dotenv/config index.js
[info]: unleash is starting ⏳ {
"project": "unleash",
"buildCreated": "unknown",
"buildCommit": "unknown",
"buildNumber": "unknown"
}
[2023-06-09T15:34:42.787] [DEBUG] server-impl.js - DB migration: start
[2023-06-09T15:34:42.801] [ERROR] server-impl.js - Failed to migrate db Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/string-width/index.js from /Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/yargs/build/lib/usage.js not supported.
Instead change the require of index.js in /Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/yargs/build/lib/usage.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/yargs/build/lib/usage.js:12:21)
at Object.<anonymous> (/Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/yargs/build/lib/yargs.js:7:17)
at Object.<anonymous> (/Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/yargs/yargs.js:7:27)
at Object.<anonymous> (/Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/yargs/index.js:5:15)
at Object.<anonymous> (/Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/db-migrate/lib/commands/set-default-argv.js:1:13)
at register (/Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/db-migrate/lib/commands/index.js:6:10)
at new dbmigrate (/Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/db-migrate/api.js:27:24)
at module.exports.getInstance (/Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/db-migrate/index.js:85:10)
at migrateDb (/Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/unleash-server/dist/migrator.js:15:46)
at start (/Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/unleash-server/dist/lib/server-impl.js:151:48)
at Object.start (/Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/@ivarconr/unleash-enterprise/dist/index.js:45:39)
at main (/Users/ryan/Code/<redacted>/Unleash/unleash/index.js:43:18)
at Object.<anonymous> (/Users/ryan/Code/<redacted>/Unleash/unleash/index.js:51:1) {
code: 'ERR_REQUIRE_ESM'
}
[error]: unleash failed {
"project": "unleash",
"buildCreated": "unknown",
"buildCommit": "unknown",
"buildNumber": "unknown"
}
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/string-width/index.js from /Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/yargs/build/lib/usage.js not supported.
Instead change the require of index.js in /Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/yargs/build/lib/usage.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/yargs/build/lib/usage.js:12:21)
at Object.<anonymous> (/Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/yargs/build/lib/yargs.js:7:17)
at Object.<anonymous> (/Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/yargs/yargs.js:7:27)
at Object.<anonymous> (/Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/yargs/index.js:5:15)
at Object.<anonymous> (/Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/db-migrate/lib/commands/set-default-argv.js:1:13)
at register (/Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/db-migrate/lib/commands/index.js:6:10)
at new dbmigrate (/Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/db-migrate/api.js:27:24)
at module.exports.getInstance (/Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/db-migrate/index.js:85:10)
at migrateDb (/Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/unleash-server/dist/migrator.js:15:46)
at start (/Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/unleash-server/dist/lib/server-impl.js:151:48)
at Object.start (/Users/ryan/Code/<redacted>/Unleash/unleash/node_modules/@ivarconr/unleash-enterprise/dist/index.js:45:39)
at main (/Users/ryan/Code/<redacted>/Unleash/unleash/index.js:43:18)
at Object.<anonymous> (/Users/ryan/Code/<redacted>/Unleash/unleash/index.js:51:1) {
code: 'ERR_REQUIRE_ESM'
}
✨ Done in 1.02s.
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0:
- name string-width-cjs
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"
# ran yarn upgrade; this was in the yarn.lock diff before/after upgrade
➜ unleash git:(main) βœ— yarn why string-width
yarn why v1.22.19
[1/4] πŸ€” Why do we have the module "string-width"...?
[2/4] 🚚 Initialising dependency graph...
[3/4] πŸ” Finding dependency...
[4/4] 🚑 Calculating file sizes...
=> Found "string-width@4.2.3"
info Has been hoisted to "string-width"
info Reasons this module exists
- Hoisted from "@ivarconr#unleash-enterprise#unleash-server#db-migrate#yargs#string-width"
- Hoisted from "@ivarconr#unleash-enterprise#unleash-server#db-migrate#yargs#cliui#string-width"
- Hoisted from "@ivarconr#unleash-enterprise#unleash-server#db-migrate#yargs#cliui#wrap-ansi#string-width"
- Hoisted from "@ivarconr#unleash-enterprise#make-fetch-happen#cacache#glob#jackspeak#@isaacs#cliui#wrap-ansi-cjs#string-width"
info Disk size without dependencies: "20KB"
info Disk size with unique dependencies: "128KB"
info Disk size with transitive dependencies: "148KB"
info Number of shared dependencies: 4
=> Found "@isaacs/cliui#string-width@5.1.2"
info Reasons this module exists
- "@ivarconr#unleash-enterprise#make-fetch-happen#cacache#glob#jackspeak#@isaacs#cliui" depends on it
- Hoisted from "@ivarconr#unleash-enterprise#make-fetch-happen#cacache#glob#jackspeak#@isaacs#cliui#wrap-ansi#string-width"
info Disk size without dependencies: "20KB"
info Disk size with unique dependencies: "128KB"
info Disk size with transitive dependencies: "148KB"
info Number of shared dependencies: 4
✨ Done in 0.12s.
➜ unleash git:(main) βœ— yarn why string-width-cjs
yarn why v1.22.19
[1/4] πŸ€” Why do we have the module "string-width-cjs"...?
[2/4] 🚚 Initialising dependency graph...
[3/4] πŸ” Finding dependency...
[4/4] 🚑 Calculating file sizes...
=> Found "string-width-cjs@4.2.3"
info Reasons this module exists
- "@ivarconr#unleash-enterprise#make-fetch-happen#cacache#glob#jackspeak#@isaacs#cliui" depends on it
- Hoisted from "@ivarconr#unleash-enterprise#make-fetch-happen#cacache#glob#jackspeak#@isaacs#cliui#string-width-cjs"
info Disk size without dependencies: "20KB"
info Disk size with unique dependencies: "128KB"
info Disk size with transitive dependencies: "148KB"
info Number of shared dependencies: 4
✨ Done in 0.11s.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment