当我运行
npm install
时,我收到以下警告:
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
我的
har-validator
中没有 package.json
,并且 uuid
在我的软件包中设置为版本 9。
为什么会出现此错误,以及如何修复这些错误?
"dependencies": {
"bcrypt": "^5.1.0",
"body-parser": "^1.20.1",
"colors": "^1.4.0",
"dateformat": "^4.6.3",
"dns-packet": "^5.4.0",
"dotenv": "^16.0.3",
"express": "^4.18.2",
"joi": "^17.6.4",
"jsonwebtoken": "^9.0.0",
"mongodb": "^4.11.0",
"mqtt-packet": "^8.1.2",
"semver": "^7.5.4",
"uuid": "^9.0.0",
"ws": "^8.10.0"
},
"devDependencies": {
"eslint": "^8.24.0",
"grunt": "^1.5.3",
"grunt-contrib-compress": "^2.0.0",
"grunt-contrib-uglify": "^5.0.1",
"grunt-env": "^1.0.1",
"grunt-run": "^0.8.1",
"minimist": "^1.2.6",
"mocha": "^9.2.2",
"mocha.parallel": "^0.15.6",
"newman": "^6.0.0",
"nodemon": "^3.0.1",
"sinon": "^14.0.2"
}
感谢@jonrsharpe评论,我发现这是由newman引起的。
npm explain har-validator
:
[email protected] dev
node_modules/har-validator
har-validator@"~5.1.3" from [email protected]
node_modules/postman-request
postman-request@"2.88.1-postman.33" from [email protected]
node_modules/newman
dev newman@"^6.0.0" from the root project
postman-request@"2.88.1-postman.33" from [email protected]
node_modules/postman-runtime
postman-runtime@"7.33.0" from [email protected]
node_modules/newman
dev newman@"^6.0.0" from the root project
将 newman 安装到空项目/文件夹中会出现完全相同的错误。
marc@stirner:/tmp/test-newman$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See `npm help init` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
package name: (test-newman)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to /tmp/test-newman/package.json:
{
"name": "test-newman",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
Is this OK? (yes)
marc@stirner:/tmp/test-newman$ npm install newman
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
added 117 packages, and audited 118 packages in 2s
9 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
marc@stirner:/tmp/test-newman$