Reputation: 2816
Why is it that when including dependencies in package.json such as
"dependencies": {
"nodemailer": "*"
}
and running
npm install
doesn't install the package but doing
npm install nodemailer
is ok?
in both instances, the message returned was
WARN Invalid name: "try node mailer"
WARN email No description
WARN email No repository field
WARN email No README field
WARN email No license field
but only in the second instance the node_modules directory is populated with the package
Upvotes: 0
Views: 178
Reputation: 3336
Rather than using a wildcard, you can try ""
instead. Otherwise this seems to be working:
{
"name": "testr",
"version": "1.0.0",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"nodemailer": "^4.0.1"
},
"author": "",
"license": "ISC"
}
Upvotes: 1
Reputation: 3614
I'd suggest that you use some of the other version matching ranges and avoid the asterix one,, as per specs @page: https://docs.npmjs.com/files/package.json#dependencies
I did it fine with this one:
{
"name": "test",
"version": "1.0.0",
"description": "my test",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"nodemailer": "~2"
},
"author": "",
"license": "ISC"
}
hope that helps you
Upvotes: 2