Skip to content

Commit f31591c

Browse files
authored
Fix Docker tutorial (#1316)
Example uses the Node.js 6 Docker image with npm@3, so "npm install" won't create a `package-lock.json`. If the reader follows the tutorial step-by-step, it would not have been created even for npm@5, as a local `npm install` step is missing.
1 parent 859f232 commit f31591c

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

locale/en/docs/guides/nodejs-docker-webapp.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,14 @@ WORKDIR /usr/src/app
9696
This image comes with Node.js and NPM already installed so the next thing we
9797
need to do is to install your app dependencies using the `npm` binary. Please
9898
note that if you are using `npm` version 5 or later you will also want to copy
99-
`package-lock.json`:
99+
`package-lock.json`, which is gernerated once you run `npm install`:
100100

101101
```docker
102102
# Install app dependencies
103-
COPY package.json package-lock.json .
103+
COPY package.json .
104+
# For npm@5 or later, copy package-lock.json as well
105+
# COPY package.json package-lock.json .
106+
104107
RUN npm install
105108
```
106109

@@ -141,7 +144,10 @@ FROM node:boron
141144
WORKDIR /usr/src/app
142145
143146
# Install app dependencies
144-
COPY package.json package-lock.json .
147+
COPY package.json .
148+
# For npm@5 or later, copy package-lock.json as well
149+
# COPY package.json package-lock.json .
150+
145151
RUN npm install
146152
147153
# Bundle app source

0 commit comments

Comments
 (0)