-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] npm install --production creates/leaves behind empty directories of some devDependencies #3975
Comments
I have exactly this problem! I notice it is also downloading the To reproduce, launch a node docker container. docker run -it --rm node:gallium-alpine3.14 sh Inside the container create the @rmuchall sample cat << EOF > package.json
{
"name": "npm-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"dayjs": "^1.10.7"
},
"devDependencies": {
"webpack-cli": "^4.9.1"
}
}
EOF
npm install --production --loglevel verbose In the output I see requests for webpack.
See the full log output: npm.log |
For comparison I tested with a {
"name": "npm-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"dayjs": "^1.10.7"
}
} The output looks like this: npm2.log |
Relates to npm/cli#2921 This issue arises after moving from npm 6.x to 7.x or later. As the build agents are still on 6.x, we have not yet seen this issue there. As part of the release build for Keyman Developer, we bundle up some files and do some work in a temp folder to prepare folders for release. Even though we are only working with `dependencies` (e.g. using `npm install --production`), packages under `devDependencies` are still wrongly being checked by NPM. As we have two modules present in `devDependencies` that are only available when in the repo path, we need to remove them before attempting to continue. Yuck! ref: npm/cli#3975 (comment) ref: npm/cli#2921
Relates to npm/cli#2921 This issue arises after moving from npm 6.x to 7.x or later. As the build agents are still on 6.x, we have not yet seen this issue there. As part of the release build for Keyman Developer, we bundle up some files and do some work in a temp folder to prepare folders for release. Even though we are only working with `dependencies` (e.g. using `npm install --production`), packages under `devDependencies` are still wrongly being checked by NPM. As we have two modules present in `devDependencies` that are only available when in the repo path, we need to remove them before attempting to continue. Yuck! ref: npm/cli#3975 (comment) ref: npm/cli#2921
Had the same issue on Debian (stretch). Tested a bunch of NPM versions (v8.19.2 - v7.0.0) and had the same issue. The latest version that doesn't have the issue is v6.14.17, so using that as a work around for now |
I am encountering an issue that I believe is the same as this one. I am using node v21.4.0 and NPM v10.2.5. Here is my package.json:
When I run
The fact that all the empty directories begin with "@" suggests to me that there might be an issue with that character. This is also the case when I install my actual package.json, which has a much larger number of devDependencies; it leaves behind a great many more empty directories, but all the directories left behind have names beginning with "@". |
Is there an existing issue for this?
Current Behavior
When using the command
npm install --production
npm creates (and/or fails to remove during execution) empty directories for some devDependencies.Expected Behavior
When using the command
npm --production
I expect npm to install only the packages listed in dependencies, omit the packages listed in devDependencies and not create/leave behind empty directories for any devDependency packages.Steps To Reproduce
npm install --production
Environment
The text was updated successfully, but these errors were encountered: