DataDog / datadog-ci

Use Datadog from your CI.
https://datadoghq.com
Apache License 2.0
127 stars 55 forks source link

Fails build in expo: `Cannot find module 'inquirer/lib/prompts/base'` #897

Open knownasilya opened 1 year ago

knownasilya commented 1 year ago

Bug description

Building my app in expo I get this error:

[stderr] 
Exception raised during command execution, stderr=error Command failed with exit code 1.
[stderr] 
, stdout=yarn run v1.22.17
[stderr] 
$ /home/expo/workingdir/build/node_modules/.bin/datadog-ci react-native upload --platform android --service com.teamganttnext --bundle /home/expo/workingdir/build/android/app/build/generated/assets/react/release/index.android.bundle --sourcemap /home/expo/workingdir/build/android/app/build/generated/sourcemaps/react/release/index.android.bundle.map --release-version 2.4.12 --build-version 1562782168
[stderr] 
Error: Cannot find module 'inquirer/lib/prompts/base'
[stderr] 
Require stack:
[stderr] 
- /home/expo/workingdir/build/node_modules/inquirer-checkbox-plus-prompt/index.js
[stderr] 
- /home/expo/workingdir/build/node_modules/@datadog/datadog-ci/dist/commands/lambda/prompt.js
[stderr] 
- /home/expo/workingdir/build/node_modules/@datadog/datadog-ci/dist/commands/lambda/functions/commons.js
[stderr] 
- /home/expo/workingdir/build/node_modules/@datadog/datadog-ci/dist/commands/lambda/instrument.js
[stderr] 
- /home/expo/workingdir/build/node_modules/@datadog/datadog-ci/dist/commands/lambda/cli.js
[stderr] 
- /home/expo/workingdir/build/node_modules/@datadog/datadog-ci/dist/cli.js
[stderr] 
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
[stderr] 
    at Function.Module._load (node:internal/modules/cjs/loader:833:27)
[stderr] 
    at Module.require (node:internal/modules/cjs/loader:1057:19)
[stderr] 
    at require (node:internal/modules/cjs/helpers:103:18)
[stderr] 
    at Object.<anonymous> (/home/expo/workingdir/build/node_modules/inquirer-checkbox-plus-prompt/index.js:14:12)
[stderr] 
    at Module._compile (node:internal/modules/cjs/loader:1155:14)
[stderr] 
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
[stderr] 
    at Module.load (node:internal/modules/cjs/loader:1033:32)
[stderr] 
    at Function.Module._load (node:internal/modules/cjs/loader:868:12)
[stderr] 
    at Module.require (node:internal/modules/cjs/loader:1057:19) {
[stderr] 
  code: 'MODULE_NOT_FOUND',
[stderr] 
  requireStack: [
[stderr] 
    '/home/expo/workingdir/build/node_modules/inquirer-checkbox-plus-prompt/index.js',
[stderr] 
    '/home/expo/workingdir/build/node_modules/@datadog/datadog-ci/dist/commands/lambda/prompt.js',
[stderr] 
    '/home/expo/workingdir/build/node_modules/@datadog/datadog-ci/dist/commands/lambda/functions/commons.js',
[stderr] 
    '/home/expo/workingdir/build/node_modules/@datadog/datadog-ci/dist/commands/lambda/instrument.js',
[stderr] 
    '/home/expo/workingdir/build/node_modules/@datadog/datadog-ci/dist/commands/lambda/cli.js',
[stderr] 
    '/home/expo/workingdir/build/node_modules/@datadog/datadog-ci/dist/cli.js'
[stderr] 
  ]
[stderr] 
}

Related issue: https://github.com/DataDog/datadog-ci/issues/752

Describe what you expected

Things to work 😄

Steps to reproduce the issue

I used latest version, 2.12.0. Not sure why I need datadog-ci, it was part of the react-native/expo instructions.

Additional context

Command

None

knownasilya commented 1 year ago

Any ideas?

knownasilya commented 1 year ago

Installing latest inquirer in devdeps fixes this issue but raises

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/expo/workingdir/build/node_modules/inquirer/lib/prompts/base.js from /home/expo/workingdir/build/node_modules/inquirer-checkbox-plus-prompt/index.js not supported.
[stderr] 
Instead change the require of base.js in /home/expo/workingdir/build/node_modules/inquirer-checkbox-plus-prompt/index.js to a dynamic import() which is available in all CommonJS modules.

Going to try a specific version of inquirer

knownasilya commented 1 year ago

Ok that fixes my issue.. but it seems to still be a bug, users shouldn't have to install deps of this library.