0

Due to a new npm package I installed I recently started to receive SyntaxErrors concerning the use of the keyword 'const'.

After some research, I came across this topic on StackOverflow, saying that ECMAScript2015 isn't enabled by default on the older Node.js

As I'm using Docker to host my web application, I'm wondering how to include harmony-tag into the Dockerfile:

FROM centos:centos6

RUN yum install -y epel-release
RUN yum install -y nodejs npm

COPY package.json /ProjectName/package.json

# Set the working directory
WORKDIR /ProjectName

RUN npm install --production

COPY . /ProjectName

EXPOSE 8080

CMD ["npm", "start"]

Or do you consider another solution?

Thanks

Community
  • 1
  • 1
Goowik
  • 782
  • 11
  • 36

1 Answers1

1

Just add the flag in your package.json start script command. But i would recommend using the official node container as a base and use at least the lts (currently 4.6) version. Older node versions are pretty outdated and with docker it should be pretty easy to update.

Official node image:

https://hub.docker.com/_/node/

Johannes Merz
  • 3,252
  • 17
  • 33