OpenSearch Dashboards build error when yarn osd bootstrap

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
node version v14.21.3

Describe the issue:
I I am not a native English speaker, so I apologize if my expression is not clear.
When I run yarn osd bootstrap according to the opensearch dashboards developer guide, I get the following error
Can someone please tell me how to solve this problem?
Relevant Logs or Screenshots:

[xxxx@xxxxxxxx OpenSearch-Dashboards]# yarn osd bootstrap
yarn run v1.22.19
$ scripts/use_node scripts/osd bootstrap
info [opensearch-dashboards] running yarn

warning workspace-aggregator-347a4f9b-4cfe-4abb-a844-9bc05b51bc6a > osd_tp_run_pipeline > @elastic/eui > @types/vfile-message@2.0.0: This is a stub types definition. vfile-message provides its own type definitions, so you do not need this installed.
[3/5] Fetching packages…
error grunt@1.6.1: The engine “node” is incompatible with this module. Expected version “>=16”. Got “14.21.3”
error Found incompatible module.
info Visit yarn install | Yarn for documentation about this command.
ERROR [bootstrap] failed:
ERROR Error: Command failed with exit code 1: /root/.nvm/versions/node/v14.21.3/lib/node_modules/yarn/bin/yarn.js install --non-interactive
at makeError (/root/OpenSearch-Dashboards/packages/osd-pm/dist/index.js:25045:11)
at handlePromise (/root/OpenSearch-Dashboards/packages/osd-pm/dist/index.js:23981:26)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async installInDir (/root/OpenSearch-Dashboards/packages/osd-pm/dist/index.js:23704:3)
at async Project.installDependencies (/root/OpenSearch-Dashboards/packages/osd-pm/dist/index.js:15168:5)
at async Object.run (/root/OpenSearch-Dashboards/packages/osd-pm/dist/index.js:9188:11)
at async runCommand (/root/OpenSearch-Dashboards/packages/osd-pm/dist/index.js:56360:5)
at async Object.run (/root/OpenSearch-Dashboards/packages/osd-pm/dist/index.js:278:3)
error Command failed with exit code 1.
info Visit yarn run | Yarn for documentation about this command.

You need to install NVM and use the required version of NODE.js (14.21.3)

After installing the NVM, run the commands:

nvm install 14.21.3
nvm use 14.21.3

Even though you have 14.21.3 installed, you need to check the current version of Nodejs

error grunt@1.6.1: The engine “node” is incompatible with this module. Expected version “>=16”. Got “14.21.3”

Hmm, that’s odd. Version 14.21.3 is the correct node version as specified in .nvmrc: https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/.nvmrc

On a fresh checkout of main, if I run yarn osd clean followed by yarn osd bootstrap, it uses the correct version of grunt, which is 1.5.3. So for some reason, your run doesn’t seem to be respecting the yarn.lock file: https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/yarn.lock#L9241-L9242

Can you try again after running yarn osd clean, and also verify that the yarn.lock file is present?

1 Like

I ran yarn osd clean and then yarn osd bootstrap again and got the same error.

[xxxx@xxxxxxxx OpenSearch-Dashboards]# yarn osd clean
yarn run v1.22.19
$ scripts/use_node scripts/osd clean
âś” build,data/optimize,built_assets,.eslintcache,.node_binaries,src/plugins/*/target
Done in 0.46s.
[3/5] Fetching packages...
error grunt@1.6.1: The engine "node" is incompatible with this module. Expected version ">=16". Got "14.21.3"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
ERROR [bootstrap] failed:
ERROR Error: Command failed with exit code 1: /root/.nvm/versions/node/v14.21.3/lib/node_modules/yarn/bin/yarn.js install --non-interactive
          at makeError (/root/OpenSearch-Dashboards/packages/osd-pm/dist/index.js:25045:11)
          at handlePromise (/root/OpenSearch-Dashboards/packages/osd-pm/dist/index.js:23981:26)
          at processTicksAndRejections (internal/process/task_queues.js:95:5)
          at async installInDir (/root/OpenSearch-Dashboards/packages/osd-pm/dist/index.js:23704:3)
          at async Project.installDependencies (/root/OpenSearch-Dashboards/packages/osd-pm/dist/index.js:15168:5)
          at async Object.run (/root/OpenSearch-Dashboards/packages/osd-pm/dist/index.js:9188:11)
          at async runCommand (/root/OpenSearch-Dashboards/packages/osd-pm/dist/index.js:56360:5)
          at async Object.run (/root/OpenSearch-Dashboards/packages/osd-pm/dist/index.js:278:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Yes, the yarn.lock file is present and the following entry exists.

"grunt@npm:^1.5.2":
  version: 1.6.1
  resolution: "grunt@npm:1.6.1"
  dependencies:
    dateformat: ~4.6.2
    eventemitter2: ~0.4.13
    exit: ~0.1.2
    findup-sync: ~5.0.0
    glob: ~7.1.6
    grunt-cli: ~1.4.3
    grunt-known-options: ~2.0.0
    grunt-legacy-log: ~3.0.0
    grunt-legacy-util: ~2.0.1
    iconv-lite: ~0.6.3
    js-yaml: ~3.14.0
    minimatch: ~3.0.4
    nopt: ~3.0.6
  bin:
    grunt: bin/grunt
  checksum: bc03f5bba1edee2f3ac01cf8c5d4a2fe787d2244b7aa7bf73278b1295489dcf10639e531fe0a0af5d2e83e4df2a15cd9bde495f510ffb0b5c3126b16bf37993d
  languageName: node
  linkType: hard

Thank you for your support!