-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Open
Labels
Bugthing that needs fixingthing that needs fixingPriority 2secondary priority issuesecondary priority issueRelease 8.xwork is associated with a specific npm 8 releasework is associated with a specific npm 8 release
Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
When I run npm install --save-dev <package-name>
package.json is not modified; nothing is added to devDependencies
.
Expected Behavior
I would expect that a command like npm install --save-dev <package-name>
would install that package in the current directory and add the package information in package.json's devDepencies object.
Steps To Reproduce
- In this environment...
[~/test]$ npm -v
8.15.0
[~/test]$ node -v
v18.7.0
[~/test]$ sw_vers
ProductName: macOS
ProductVersion: 12.4
BuildVersion: 21F79
- With this config...
$ npm config list
package-lock = false
save = false
save-exact = false
save-prefix = "^"
- Run '...'
[~/test]$ rm -rf package.json
[~/test]$ rm -rf node_modules
[~/test]$ npm init -y
Wrote to /Users/matt/test/package.json:
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
[~/test]$ npm install --save-dev mocha
added 79 packages, and audited 80 packages in 6s
20 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
[~/test]$ cat package.json
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
[~/test]$
- See error...
devDependencies
does not exist as expected.
Environment
- npm: 8.15.0
- Node.js: 18.7.0
- OS Name: macOS 12.4
- System Model Name:
- npm config:
package-lock = false
save = false
save-exact = false
save-prefix = "^"
Metadata
Metadata
Assignees
Labels
Bugthing that needs fixingthing that needs fixingPriority 2secondary priority issuesecondary priority issueRelease 8.xwork is associated with a specific npm 8 releasework is associated with a specific npm 8 release