我无法使用 npm 安装包裹
Posted
技术标签:
【中文标题】我无法使用 npm 安装包裹【英文标题】:I cant install parcel with npm 【发布时间】:2020-12-03 13:22:10 【问题描述】:我正在尝试使用
安装包裹 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 chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
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
npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
C:\Users\Atrur\AppData\Roaming\npm\parcel -> C:\Users\Atrur\AppData\Roaming\npm\node_modules\parcel-bundler\bin\cli.js
> parcel-bundler@1.12.4 postinstall C:\Users\Atrur\AppData\Roaming\npm\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')"
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\parcel-bundler\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted "os":"darwin","arch":"any" (current: "os":"win32","arch":"x64")
+ parcel-bundler@1.12.4
updated 1 package in 37.266s
我试过了
npm install --save core-js@^3
但是没用
这里是 package.json
"name": "saas",
"version": "1.0.0",
"main": "index.js",
"scripts":
"test": "echo \"Error: no test specified\" && exit 1"
,
"author": "",
"license": "ISC",
"dependencies":
"core-js": "^3.6.5",
"lodash": "^4.17.19"
,
"devDependencies": ,
"keywords": [],
"description": ""
我是 npm 新手,所以我不知道如何修复这个错误 如果你能帮助我,我已经尝试了一切,我会很高兴
【问题讨论】:
它是parcel-bundler
的依赖项,而不是 your 代码。我知道 w/ yarn 你可以强制版本解析;你也许可以用npm
做同样的事情。但是你不能保证它会工作不同的版本。
【参考方案1】:
您正在使用 NPM's global flag:-g
安装 Parcel,它将全局安装,因此您可以从任何地方访问该软件包。
要安装到本地目录或项目,只需删除标志:
npm install parcel-bundler
安装包时,它的依赖项也会自动安装,因此您不必手动添加它们。
【讨论】:
以上是关于我无法使用 npm 安装包裹的主要内容,如果未能解决你的问题,请参考以下文章