文件
FROM node:alpine
COPY ./ ./
RUN npm install
CMD ["npm", "start"]
Run Code Online (Sandbox Code Playgroud)
索引.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");
});
Run Code Online (Sandbox Code Playgroud)
包.json
{
"dependencies": {
"express": "*"
},
"scripts": {
"start": "node index.js"
}
}
Run Code Online (Sandbox Code Playgroud)
码头工人建造。
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 …Run Code Online (Sandbox Code Playgroud)