Skip to content

Add Node.js prerequisite check to make deps target#4168

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/fix-deps-dev-error
Closed

Add Node.js prerequisite check to make deps target#4168
Copilot wants to merge 3 commits intomainfrom
copilot/fix-deps-dev-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 17, 2025

The make deps target silently fails in environments without Node.js, causing prettier to install but be non-functional, leading to cryptic "node: not found" errors during make deps-dev.

Changes

  • Makefile: Added Node.js/npm availability check before installing prettier

    • Fails fast with installation instructions for nvm, Ubuntu/Debian, and macOS
    • Follows existing pattern from golint target
  • Documentation: Added Node.js 24+ to prerequisites in CONTRIBUTING.md and DEVGUIDE.md

  • Devcontainer: Added explicit nvm configuration to .devcontainer/devcontainer.json

    • Added nvmVersion: "latest" to ensure nvm is available in the development container
    • Complements existing Node.js 24 configuration

Error Message

$ make deps  # without Node.js installed

Node.js and npm are required but not installed.
Please install Node.js (version 24 or later recommended) using one of these methods:

Using nvm (recommended):
  curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
  source ~/.bashrc  # or source ~/.zshrc
  nvm install 24

On Ubuntu/Debian:
  curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash -
  sudo apt-get install -y nodejs
...

Fixes #4160

Original prompt

This section details on the original issue you should resolve

<issue_title>make deps-dev fails because of missing prettier/node installation</issue_title>
<issue_description>small issue when setup a dev environment in a clean ubuntu

make deps-dev fails with the error below.

looking into the makefile, it seems that prettier is missing despite it is installed as prerequisite
npm install -g prettier

merklbe1@H69LST3:~/gh-aw$ prettier
/mnt/c/Users/merklbe1/AppData/Roaming/npm/prettier: 15: exec: node: not found

possible fix: install node automatically via the dependencies

merklbe1@H69LST3:~/gh-aw$ make deps-dev
go mod download
go mod tidy
go install golang.org/x/tools/gopls@latest
go: golang.org/x/tools/gopls@v0.20.0 requires go >= 1.24.2; switching to go1.24.10
go install github.com/rhysd/actionlint/cmd/actionlint@latest
go: github.com/rhysd/actionlint@v1.7.8 requires go >= 1.24.0; switching to go1.24.10
npm install -g prettier

changed 1 package in 1s

1 package is looking for funding
  run `npm fund` for details
Downloading GitHub Actions workflow schema...
Formatting schema with prettier...
make: *** [Makefile:136: download-github-actions-schema] Error 127
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

- Add Node.js/npm availability check before installing prettier
- Provide helpful error message with installation instructions for multiple platforms
- Update CONTRIBUTING.md and DEVGUIDE.md to list Node.js as prerequisite
- Follows existing pattern from golint target for missing tool detection

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix make deps-dev to install node automatically Add Node.js prerequisite check to make deps target Nov 17, 2025
Copilot AI requested a review from pelikhan November 17, 2025 00:18
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot make sure devcontainer.json has node and nvm installed

- Add nvmVersion: latest to node feature in devcontainer.json
- Ensures nvm is explicitly available in the development container
- Node.js 24 was already configured, now nvm is also explicitly set

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Nov 17, 2025

@copilot make sure devcontainer.json has node and nvm installed

Added explicit nvm configuration to devcontainer.json. The node feature now includes "nvmVersion": "latest" to ensure nvm is available in the development container. (bf303fc)

@pelikhan pelikhan marked this pull request as ready for review November 17, 2025 00:56
Copilot AI review requested due to automatic review settings November 17, 2025 00:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses issue #4160 by adding prerequisite checks and documentation to prevent silent failures when Node.js is not installed. The make deps target previously would silently install prettier without Node.js, leading to cryptic "node: not found" errors during subsequent development tasks.

Key changes:

  • Added fail-fast Node.js/npm availability check to make deps target with helpful installation instructions
  • Updated prerequisites documentation in CONTRIBUTING.md and DEVGUIDE.md to explicitly require Node.js 24+
  • Enhanced devcontainer configuration with explicit nvm support

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
Makefile Added Node.js prerequisite check before prettier installation with detailed installation instructions for nvm, Ubuntu/Debian, and macOS
DEVGUIDE.md Added comprehensive prerequisites section documenting Node.js 24+ requirement along with Go, GitHub CLI, and Git
CONTRIBUTING.md Added Node.js 24+ to prerequisites list for consistency with DEVGUIDE.md
.devcontainer/devcontainer.json Added nvmVersion: "latest" to node feature configuration to ensure nvm availability in development containers

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +124 to +141
echo ""; \
echo "Node.js and npm are required but not installed."; \
echo "Please install Node.js (version 24 or later recommended) using one of these methods:"; \
echo ""; \
echo "Using nvm (recommended):"; \
echo " curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash"; \
echo " source ~/.bashrc # or source ~/.zshrc"; \
echo " nvm install 24"; \
echo ""; \
echo "On Ubuntu/Debian:"; \
echo " curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash -"; \
echo " sudo apt-get install -y nodejs"; \
echo ""; \
echo "On macOS with Homebrew:"; \
echo " brew install node"; \
echo ""; \
echo "For other platforms, see: https://nodejs.org/en/download/package-manager"; \
echo ""; \
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The error message spans many lines (lines 124-142) which makes the Makefile harder to read and maintain. Following the pattern from the golint target (lines 165-174), consider extracting the installation instructions to a smaller, more focused message or using a here-document for better readability.

Example approach similar to golint:

@if command -v node >/dev/null 2>&1 && command -v npm >/dev/null 2>&1; then \
	npm install -g prettier; \
else \
	echo "Node.js and npm are required but not installed."; \
	echo "Install Node.js 24+ using nvm (recommended), package manager, or see:"; \
	echo "  https://nodejs.org/en/download/package-manager"; \
	exit 1; \
fi

This maintains the fail-fast behavior while keeping the Makefile more maintainable.

Suggested change
echo ""; \
echo "Node.js and npm are required but not installed."; \
echo "Please install Node.js (version 24 or later recommended) using one of these methods:"; \
echo ""; \
echo "Using nvm (recommended):"; \
echo " curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash"; \
echo " source ~/.bashrc # or source ~/.zshrc"; \
echo " nvm install 24"; \
echo ""; \
echo "On Ubuntu/Debian:"; \
echo " curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash -"; \
echo " sudo apt-get install -y nodejs"; \
echo ""; \
echo "On macOS with Homebrew:"; \
echo " brew install node"; \
echo ""; \
echo "For other platforms, see: https://nodejs.org/en/download/package-manager"; \
echo ""; \
echo "Node.js and npm are required but not installed."; \
echo "Please install Node.js (version 24 or later recommended). See:"; \
echo " https://nodejs.org/en/download/package-manager"; \

Copilot uses AI. Check for mistakes.
@pelikhan pelikhan closed this Nov 17, 2025
@pelikhan pelikhan deleted the copilot/fix-deps-dev-error branch November 19, 2025 00:34
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

Successfully merging this pull request may close these issues.

make deps-dev fails because of missing prettier/node installation

3 participants