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

Add Nodejs to the Dockerfile. #380

Open
markanton1727 opened this issue Dec 13, 2023 · 1 comment
Open

Add Nodejs to the Dockerfile. #380

markanton1727 opened this issue Dec 13, 2023 · 1 comment

Comments

@markanton1727
Copy link

Thank you very much for the repository; it has been very helpful to me. However, I have a problem. When trying to install the Bootstrap gem, I receive the following error: usr/local/bundle/gems/execjs-2.9.1/lib/execjs/runtimes.rb:68:in autodetect': Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable).

I have attempted to install Node.js within the Dockerfile, but I have not succeeded. Is it possible to add the installation of Node.js for the proper functioning of the Bootstrap gem?

Regards.

@ryanwi
Copy link
Owner

ryanwi commented Dec 13, 2023

Good question. One of the experiments with this repository was to see if node.js could be avoided altogether. So, it is not installed on purpose (at this point).

What version of the Bootstrap gem are you using? I'm curious to check it out.

I have attempted to install Node.js within the Dockerfile, but I have not succeeded

The new Dockerfile in Rails 7.1 does have a way to include node still though: https://github.com/rails/rails/blob/main/railties/lib/rails/generators/rails/app/templates/Dockerfile.tt#L24

You can try adding that block directly to your Dockerfile

# Install JavaScript dependencies
ARG NODE_VERSION=<%= node_version %>
ARG YARN_VERSION=<%= dockerfile_yarn_version %>
ENV PATH=/usr/local/node/bin:$PATH
RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
    /tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \
    npm install -g yarn@$YARN_VERSION && \
    rm -rf /tmp/node-build-master

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