我在安装 Npm Multer 以使用节点上传文件时遇到错误.js


npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
npm WARN task-manager@1.0.0 No description
npm WARN task-manager@1.0.0 No repository field.
npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path D:Rakesh FolderNodeCoursetask-managernode_modules.bcrypt.DELETElibbindingnapi-v3bcrypt_lib.nodenpm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink 'D:Rakesh FolderNodeCoursetask-managernode_modules.bcrypt.DELETElibbindingnapi-v3bcrypt_lib.node'
npm ERR!  [OperationalError: EPERM: operation not permitted, unlink 'D:Rakesh FolderNodeCoursetask-managernode_modules.bcrypt.DELETElibbindingnapi-v3bcrypt_lib.node'] {
npm ERR!   cause: [Error: EPERM: operation not permitted, unlink 'D:Rakesh FolderNodeCoursetask-managernode_modules.bcrypt.DELETElibbindingnapi-v3bcrypt_lib.node'] {
npm ERR!     errno: -4048,
npm ERR!     code: 'EPERM',
npm ERR!     syscall: 'unlink',
npm ERR!     path: 'D:\Rakesh Folder\NodeCourse\task-manager\node_modules\.bcrypt.DELETE\lib\binding\napi-v3\bcrypt_lib.node'
npm ERR!   },
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path: 'D:\Rakesh Folder\NodeCourse\task-manager\node_modules\.bcrypt.DELETE\lib\binding\napi-v3\bcrypt_lib.node',
npm ERR!   parent: 'task-manager'
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!
PS D:Rakesh FolderNodeCoursetask-manager> npm i multer
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
npm WARN task-manager@1.0.0 No description
npm WARN task-manager@1.0.0 No repository field.
npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path D:Rakesh FolderNodeCoursetask-managernode_modules.bcrypt.DELETElibbindingnapi-v3bcrypt_lib.nodenpm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink 'D:Rakesh FolderNodeCoursetask-managernode_modules.bcrypt.DELETElibbindingnapi-v3bcrypt_lib.node'
npm ERR!  [OperationalError: EPERM: operation not permitted, unlink 'D:Rakesh FolderNodeCoursetask-managernode_modules.bcrypt.DELETElibbindingnapi-v3bcrypt_lib.node'] {
npm ERR!   cause: [Error: EPERM: operation not permitted, unlink 'D:Rakesh FolderNodeCoursetask-managernode_modules.bcrypt.DELETElibbindingnapi-v3bcrypt_lib.node'] {
npm ERR!     errno: -4048,
npm ERR!     code: 'EPERM',
npm ERR!     syscall: 'unlink',
npm ERR!     path: 'D:\Rakesh Folder\NodeCourse\task-manager\node_modules\.bcrypt.DELETE\lib\binding\napi-v3\bcrypt_lib.node'
npm ERR!   },
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path: 'D:\Rakesh Folder\NodeCourse\task-manager\node_modules\.bcrypt.DELETE\lib\binding\napi-v3\bcrypt_lib.node',
npm ERR!   parent: 'task-manager'
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:UsersAnneRakeshAppDataRoamingnpm-cache_logs2022-06-13T15_12_05_270Z-debug.log

请帮帮我。我在通过cmdnpm i multer

安装时面临此问题

在我的情况下,这很有帮助:

在继续执行这些命令之前,请关闭所有VS Code实例。

  1. clean cache with

    npm cache clean --force
    
  2. 作为admin全局安装最新版本的npm:

    npm install -g npm@latest --force
    
  3. clean cache with

    npm cache clean --force
    

尝试重新安装组件。

如果这不起作用,您可以暂时禁用杀毒程序,然后再试一次。

最新更新