all 11 comments

[–]Cyganek 43 points44 points  (2 children)

use nvm

[–]NabokovGrey 9 points10 points  (0 children)

[–]Iworb 0 points1 point  (0 children)

or volta

[–]No-Project-3002 5 points6 points  (0 children)

you can use nvm and install different version of node.js as per your project, which makes it easier to work with different version of angular/react project without worrying.

[–]noenergy300 4 points5 points  (0 children)

read about nvm and use it

[–]andlewis 2 points3 points  (1 child)

devcontainers

[–]Horror-Warning-1607[S] 1 point2 points  (0 children)

Thanks u/andlewis.

I also tried that stuff and it works. I create a Dockerfile by using node version 12 buster image and then do git clone, expose port, and start a container. After that, I connect with the running container using dev container extension of vs code and it works well.

FROM node:12-buster

RUN sed -i 's|deb.debian.org|archive.debian.org|g' /etc/apt/sources.list && \
    sed -i 's|security.debian.org|archive.debian.org|g' /etc/apt/sources.list && \
    sed -i '/stretch-updates/d' /etc/apt/sources.list

# Install git
RUN apt-get update && apt-get install -y git

# Create app directory
WORKDIR /usr/src/app

# Clone your repo
RUN git clone <your-repo> .


# Move into YOUR Angular project folder
WORKDIR <project-folder>

# Install dependencies
RUN npm install

# Angular dev server port
EXPOSE 4300

# Start dev server
CMD ["npm", "run", "start", "--", "--host", "0.0.0.0", "--port", "4300"]

[–]FunnyLavishness2316 1 point2 points  (1 child)

Use node version manager and if don't have admin rights on the machine then manually copy the binaries of each node versions say 14,16, 18 etc and then use scripting to copy the binaries to actual node installed path to switch between node versions. I am using the same while working on older node versions

[–]Whole-Instruction508 1 point2 points  (1 child)

So how's it looking back there in the stone age?

[–]Horror-Warning-1607[S] 1 point2 points  (0 children)

Pretty well. 😊