Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
npm run is creating if it does not exist and writing if it exists into the .npm/_logs directory.
Expected Behavior
Even if logs are turned off completely with the --logs-max=0 option, the directory is still created. This calls for workarounds if the current directory is not writable (a relatively common scenario if you're working inside a container) or workarounds, but there is apparently no way to turn it off completely.
Steps To Reproduce
This Dockerfile:
FROM node:21-alpine
RUN mkdir -p /app/test && chown -R node:node /app && npm install -g npm@latest
USER node
WORKDIR /app
COPY package.json ./
WORKDIR /app/test
ENTRYPOINT ["npm", "--logs-max=0", "run", "test"]
With this package.json
{
"name": "dotnpm-created",
"version": "1.0.0",
"description": "Test file",
"main": "index.js",
"scripts": {
"test": "echo \"test\""
},
"author": "",
"license": "ISC"
}
When run with:
podman run --rm -it -v `pwd`:/app/test -u 1001 jjmerelo/dotnpm-test
It creates a .npm file with:
.npm:
total 12
drwxr-xr-x 3 101000 jmerelo 4096 nov 28 14:38 .
drwxrwxr-x 3 jmerelo jmerelo 4096 nov 28 14:38 ..
drwxr-xr-x 2 101000 jmerelo 4096 nov 28 14:38 _logs
.npm/_logs:
total 8
drwxr-xr-x 2 101000 jmerelo 4096 nov 28 14:38 .
drwxr-xr-x 3 101000 jmerelo 4096 nov 28 14:38 ..
So it still has an empty log directory.
Environment
npm@10.2.4
node@v21.2.0
- Alpine OS
- npm config:
; node bin location = /usr/local/bin/node
; node version = v21.2.0
; npm local prefix = /app
; npm version = 10.2.4
; cwd = /app/test
; HOME = /home/node
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
npm runis creating if it does not exist and writing if it exists into the.npm/_logsdirectory.Expected Behavior
Even if logs are turned off completely with the
--logs-max=0option, the directory is still created. This calls for workarounds if the current directory is not writable (a relatively common scenario if you're working inside a container) or workarounds, but there is apparently no way to turn it off completely.Steps To Reproduce
This Dockerfile:
With this
package.json{ "name": "dotnpm-created", "version": "1.0.0", "description": "Test file", "main": "index.js", "scripts": { "test": "echo \"test\"" }, "author": "", "license": "ISC" }When run with:
podman run --rm -it -v `pwd`:/app/test -u 1001 jjmerelo/dotnpm-testIt creates a
.npmfile with:So it still has an empty log directory.
Environment
npm@10.2.4node@v21.2.0