Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion compiled_starters/javascript/.codecrafters/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@

set -e # Exit on failure

exec node app/main.js "$@"
NODE_PATH="$(dirname "$0")/node_modules" \
exec node "$(dirname "$0")/app/main.js" "$@"
Copy link

Choose a reason for hiding this comment

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

NODE_PATH has no effect with ES modules

Medium Severity

The newly added NODE_PATH environment variable is ignored by Node.js when resolving ES modules. Since package.json declares "type": "module", all .js files use the ESM resolver, which does not consult NODE_PATH (it only works with CommonJS require()). If the intent is to help Node find node_modules in a non-standard location, this setting silently does nothing, and users who add npm dependencies may encounter module-not-found errors if node_modules isn't discoverable through standard ESM resolution (walking up parent directories from the importing file).

Additional Locations (2)

Fix in Cursor Fix in Web

2 changes: 1 addition & 1 deletion compiled_starters/javascript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ That's all!

Note: This section is for stages 2 and beyond.

1. Ensure you have `node (21)` installed locally
1. Ensure you have `node (25)` installed locally
1. Run `./your_program.sh` to run your Kafka broker, which is implemented in
`app/main.js`.
1. Commit your changes and run `git push origin master` to submit your solution
Expand Down
4 changes: 2 additions & 2 deletions compiled_starters/javascript/codecrafters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ debug: false
# Use this to change the JavaScript version used to run your code
# on Codecrafters.
#
# Available versions: nodejs-21
buildpack: nodejs-21
# Available versions: nodejs-25
buildpack: nodejs-25
3 changes: 2 additions & 1 deletion compiled_starters/javascript/your_program.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ set -e # Exit early if any commands fail
#
# - Edit this to change how your program runs locally
# - Edit .codecrafters/run.sh to change how your program runs remotely
exec node app/main.js "$@"
NODE_PATH="$(dirname "$0")/node_modules" \
exec node "$(dirname "$0")/app/main.js" "$@"
19 changes: 19 additions & 0 deletions dockerfiles/nodejs-25.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# syntax=docker/dockerfile:1.7-labs
FROM node:25-alpine3.23

# Ensures the container is re-built if dependency files change
ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="package.json,package-lock.json"

RUN apk add --no-cache --upgrade 'bash>=5.3'

WORKDIR /app

# .git & README.md are unique per-repository. We ignore them on first copy to prevent cache misses
COPY --exclude=.git --exclude=README.md . /app

# Install deps
RUN npm ci

# If the node_modules directory exists, move it to /app-cached
RUN mkdir -p /app-cached
RUN if [ -d "/app/node_modules" ]; then mv /app/node_modules /app-cached; fi
3 changes: 2 additions & 1 deletion solutions/javascript/01-vi6/code/.codecrafters/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@

set -e # Exit on failure

exec node app/main.js "$@"
NODE_PATH="$(dirname "$0")/node_modules" \
exec node "$(dirname "$0")/app/main.js" "$@"
2 changes: 1 addition & 1 deletion solutions/javascript/01-vi6/code/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ That's all!

Note: This section is for stages 2 and beyond.

1. Ensure you have `node (21)` installed locally
1. Ensure you have `node (25)` installed locally
1. Run `./your_program.sh` to run your Kafka broker, which is implemented in
`app/main.js`.
1. Commit your changes and run `git push origin master` to submit your solution
Expand Down
4 changes: 2 additions & 2 deletions solutions/javascript/01-vi6/code/codecrafters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ debug: false
# Use this to change the JavaScript version used to run your code
# on Codecrafters.
#
# Available versions: nodejs-21
buildpack: nodejs-21
# Available versions: nodejs-25
buildpack: nodejs-25
3 changes: 2 additions & 1 deletion solutions/javascript/01-vi6/code/your_program.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ set -e # Exit early if any commands fail
#
# - Edit this to change how your program runs locally
# - Edit .codecrafters/run.sh to change how your program runs remotely
exec node app/main.js "$@"
NODE_PATH="$(dirname "$0")/node_modules" \
exec node "$(dirname "$0")/app/main.js" "$@"
3 changes: 2 additions & 1 deletion starter_templates/javascript/code/.codecrafters/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@

set -e # Exit on failure

exec node app/main.js "$@"
NODE_PATH="$(dirname "$0")/node_modules" \
exec node "$(dirname "$0")/app/main.js" "$@"
2 changes: 1 addition & 1 deletion starter_templates/javascript/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
attributes:
required_executable: node (21)
required_executable: node (25)
user_editable_file: app/main.js
Loading