首页 > 解决方案 > 使用 npm 下载松露时出错

问题描述

我正在尝试使用命令下载松露

npm install -g truffle

但我做不到。我有节点和 npm。我正在使用窗户。我需要更新 core-js 吗?

请帮忙。

我收到以下错误:

npm ERR! code EPERM
npm ERR! syscall rename
npm ERR! path C:\Users\hp\AppData\Roaming\npm\node_modules\truffle
npm ERR! dest C:\Users\hp\AppData\Roaming\npm\node_modules\.truffle-4MBISY9a
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\hp\AppData\Roaming\npm\node_modules\truffle' -> 'C:\Users\hp\AppData\Roaming\npm\node_modules\.truffle-4MBISY9a'
npm ERR!  [Error: EPERM: operation not permitted, rename 'C:\Users\hp\AppData\Roaming\npm\node_modules\truffle' -> 'C:\Users\hp\AppData\Roaming\npm\node_modules\.truffle-4MBISY9a'] {
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'rename',
npm ERR!   path: 'C:\\Users\\hp\\AppData\\Roaming\\npm\\node_modules\\truffle',
npm ERR!   dest: 'C:\\Users\\hp\\AppData\\Roaming\\npm\\node_modules\\.truffle-4MBISY9a'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\hp\AppData\Local\npm-cache\_logs\2021-05-10T17_46_35_651Z-debug.log

编辑

将 npm 文件夹中的文件名从 truffle 更改为 truffle-something,如上面的错误,但现在我收到此错误。

npm WARN deprecated mkdirp-promise@5.0.1: This package is broken and no longer maintained. 'mkdirp' itself supports promises now, please switch to that.
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated fsevents@2.1.3: "Please update to latest v2.3 or v2.2"
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated redux-devtools-instrument@1.10.0: Package moved to @redux-devtools/instrument.
npm WARN deprecated ethereumjs-tx@2.1.2: New package name format for new versions: @ethereumjs/tx. Please update.
npm WARN deprecated remotedev-serialize@0.1.9: Package moved to @redux-devtools/serialize.
npm WARN deprecated redux-devtools-core@0.2.1: Package moved to @redux-devtools/app.
npm WARN deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated multicodec@0.5.7: stable api reached
npm WARN deprecated node-pre-gyp@0.11.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm WARN deprecated axios@0.20.0: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
npm WARN deprecated ethereumjs-common@1.5.2: New package name format for new versions: @ethereumjs/common. Please update.
npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.

added 944 packages, and audited 945 packages in 18m

80 packages are looking for funding
  run `npm fund` for details

53 vulnerabilities (16 low, 8 moderate, 29 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

运行npm fund 给出输出system32

运行npm audit给出输出

npm ERR! code ENOLOCK
npm ERR! audit This command requires an existing lockfile.
npm ERR! audit Try creating one first with: npm i --package-lock-only
npm ERR! audit Original error: loadVirtual requires existing shrinkwrap file

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\hp\AppData\Local\npm-cache\_logs\2021-05-10T19_25_13_149Z-debug.log

标签: node.jsnpm-installtruffle

解决方案


使用这个命令

npm install truffle

这将解决所有问题


推荐阅读