尝试使用 npm 安装时出现问题:"core-js@<3 is no longer maintained"

Problems trying to install using npm: "core-js@<3 is no longer maintained"

我一直在关注网络开发教程,但我被困在了这一部分:https://btholt.github.io/intro-to-web-dev-v2/libraries#building-your-code

几天来我一直在尝试安装 parcel-bundler,但无法弄清楚我做错了什么。我也尝试了 Prettier 并得到了同样的错误。我很沮丧,运行没主意了。

我是 运行宁 npm 6.14.4node 12.16.2

这是 Users/myName (Catalina 10.15) 中的错误 npm install -g parcel-bundler:

npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
/Users/myName/.node_modules_global/bin/parcel -> /Users/myName/.node_modules_global/lib/node_modules/parcel-bundler/bin/cli.js

> parcel-bundler@1.12.4 postinstall /Users/myName/.node_modules_global/lib/node_modules/parcel-bundler
> node -e "console.log('\u001b[35m\u001b[1mLove Parcel? You can now donate to our open collective:\u001b[22m\u001b[39m\n > \u001b[34mhttps://opencollective.com/parcel/donate\u001b[0m')"

Love Parcel? You can now donate to our open collective:
 > https://opencollective.com/parcel/donate
+ parcel-bundler@1.12.4
updated 1 package in 18.055s

如果我尝试 运行 parcel --help 我被告知:-bash: parcel: command not found

所以我尝试修复第一个警告。我在底部列出了我尝试过的 SO 文章的链接。我尝试删除主目录中的 node_modules 并再次执行 npm install。我试过了npm install --save core-js@^3。我尝试执行强制清理缓存并重新安装。我试过了 npm update.

这是我的 package.json:

{
  "name": "generic_package",  <-- manually changed from myName
  "version": "1.0.0",
  "description": "Test description", <-- manually added to remove "no description" error
  "main": ".mongorc.js",
  "dependencies": {
    "core-js": "^3.6.5",     <-- looks like it's using >3v
    "lodash": "^4.17.15",
    "parcel-bundler": "^1.12.4",  <-- looks like it's there??
    "prettier": "^2.0.4"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "node build/build.js" <-- manually added as per an SO article
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "repository": { <-- manually added this object as per an SO article
    "type": "git",
    "url": "https://github.com/npm/npm.git",
    "private": true <-- manually added as per another SO article
  }
}

npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues

Problems installing express using npm.

消息 npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained 的原因是因为 parcel-bundler 具有传递依赖性在 core-js@2.6.11 上,不再支持。

看来 parcel 安装正确,所以您应该可以 运行 它。在 Linux 系统上,它会在 /usr/local/bin/parcel 下创建一个符号链接。确保“/usr/local/bin”在您的 PATH 中。

您也可以运行如下:

npm run-script parcel

在较新版本的 NPM 上,您可以运行这样:

npx parcel