Skip to content

Commit ea2ea28

Browse files
committed
Set owner of Node.js dependencies
All files in a node_modules/ folder belongs to user who doesn’t exist in a host environmnet when `npm` installs external packages inside container. This change explicitly sets the owner for these files. Signed-off-by: Evgeny Semenov <[email protected]>
1 parent 3d9129d commit ea2ea28

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

bin/setup

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,12 @@ if [[ ! -z "$DEVELOPMENT" && $DEVELOPMENT -eq 1 ]]; then
201201
fi
202202

203203
if [ ! -d ${ROOT}/node_modules ]; then
204-
${RUN} npm i
204+
${RUN} sh -c '
205+
npm i
206+
npm_res=$?
207+
chown -R "$(whoami):$(whoami)" ./node_modules
208+
exit $npm_res
209+
'
205210
fi
206211

207212
if [ "${CONTAINER_TYPE}" == "devcontainer" ]; then

0 commit comments

Comments
 (0)