I'm studying a React project and i have to say that so far i have seen just script with "start": "nodemon app.js". I'm using Windows os.
But now i try to start this node project that has this script part:
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "if [[ $NODE_ENV == 'development' ]]; then nodemon --experimental-modules; else node --experimental-modules src/index.js; fi",
"dev": "env NODE_ENV=development nodemon --ignore './tmp/' --experimental-modules ./src/index.js",
"lint": "eslint \"src/**/*.js\" --config \"../../.eslintrc\"",
"migration:up": "node -r esm ./node_modules/.bin/sequelize db:migrate",
"migration:down": "node -r esm ./node_modules/.bin/sequelize db:migrate:undo",
"seed": "node -r esm node_modules/.bin/sequelize db:seed:all"
},
And I don't know how to start it and why the developer make the start part so complicated. In fact, if i try to write the command npm start it give me the error:
> if [[ $NODE_ENV == 'development' ]]; then nodemon --experimental-modules; else node --experimental-modules src/index.js; fi
$NODE_ENV not expected.
npm ERR! code ELIFECYCLE
I search for thi NODE_ENV variable but it is only mentioned in this file Dockerfile
FROM node:14
RUN apt-get update && apt-get -y install vim
ARG NODE_ENV
WORKDIR /usr/src/app
COPY package.json ./
RUN npm i
#--quiet --production
COPY . .
CMD ["start"]
ENTRYPOINT ["npm"]
How can I start the program? And why this start command is so different?