Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: items.findLastIndex when run init command #7

Closed
liyanwei93 opened this issue Nov 6, 2024 · 3 comments
Closed

TypeError: items.findLastIndex when run init command #7

liyanwei93 opened this issue Nov 6, 2024 · 3 comments

Comments

@liyanwei93
Copy link
Collaborator

When I run stanctl-configuration-macos init on my mac, I encounter the following error after entering the parameters.

./stanctl-configuration-macos init
? Enter configuration package name: (e.g.: @ibm-instana/self-monitoring, 
my-awesome-xyz-monitoring):  @ibm-instana/opentelemetry-demo
? Enter configuration package version:  1.0.0
? Enter configuration package description:  The IBM Instana configuration package for 
opentelemetry demo
? Enter configuration package keywords (comma-separated): 
ibm,instana,opentelemetry,otel,configuration,package,demo
? Enter configuration package author:  IBM
? Enter configuration package license:  MIT

stanctl-configuration-macos init

Initialize a new configuration package

Options:
      --version  Show version number                                                                                                                   [boolean]
  -h, --help     Show help                                                                                                                             [boolean]

TypeError: items.findLastIndex is not a function
    at /snapshot/configuration/node_modules/@inquirer/checkbox/dist/cjs/index.js:55:28
    at /snapshot/configuration/node_modules/@inquirer/core/dist/cjs/lib/use-memo.js:11:27
    at withPointer (/snapshot/configuration/node_modules/@inquirer/core/dist/cjs/lib/hook-engine.js:72:25)
    at useMemo (/snapshot/configuration/node_modules/@inquirer/core/dist/cjs/lib/use-memo.js:6:46)
    at /snapshot/configuration/node_modules/@inquirer/checkbox/dist/cjs/index.js:53:39
    at workLoop (/snapshot/configuration/node_modules/@inquirer/core/dist/cjs/lib/create-prompt.js:95:42)
    at /snapshot/configuration/node_modules/@inquirer/core/dist/cjs/lib/create-prompt.js:106:17
    at /snapshot/configuration/node_modules/@inquirer/core/dist/cjs/lib/hook-engine.js:28:9
    at AsyncLocalStorage.run (node:async_hooks:327:14)
    at withHooks (/snapshot/configuration/node_modules/@inquirer/core/dist/cjs/lib/hook-engine.js:27:24)

My node version is:

 % node -v
v20.12.2
@morningspace
Copy link
Collaborator

This is because the node version being used during the compiling phase is lower than expected. Currently, we use pkg to compile node code into binary, by default it uses node v16, while the node code tested locally shows that it should be at least node v18.

@morningspace
Copy link
Collaborator

The way to workaround this is using --targets with proper values, e.g.:

pkg . --output dist/stanctl-configuration-macos --targets node18-macos-x64
pkg . --output dist/stanctl-configuration-macos --targets node18-linux-x64

A related issue created to replace pkg by other compiling tool at: #8

@liyanwei93
Copy link
Collaborator Author

The latest version has been tested and works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants