Dockerfile
FROM node:alpine
COPY ./ ./
RUN npm install
CMD ["npm", "start"]
index.js
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.send('Hi there');
});
app.listen(8080, () => {
console.log("Listening on post 8080");
});
package.json
{
"dependencies": {
"express": "*"
},
"scripts": {
"start": "node index.js"
}
}
docker build .
npm ERR! could not detect node name from path or package
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-11-23T23_36_35_301Z-debug.log
The command '/bin/sh -c npm install' returned a non-zero code: 1
I cannot understand why this does not work.