运行npm create vite@latest时出现EPERM错误

rqdpfwrv  于 2023-03-30  发布在  其他
关注(0)|答案(2)|浏览(303)

下面是错误消息:

Error: EPERM: operation not permitted, copyfile '/home/cytech/.npm/_npx/1415fee72ff6294b/node_modules/create-vite/template-vanilla/_gitignore' -> '/data/Documents/vite-project/.gitignore'
    at Object.copyFileSync (node:fs:2902:3)
    at Ne (file:///home/cytech/.npm/_npx/1415fee72ff6294b/node_modules/create-vite/dist/index.mjs:52:325)
    at T (file:///home/cytech/.npm/_npx/1415fee72ff6294b/node_modules/create-vite/dist/index.mjs:49:157)
    at Jr (file:///home/cytech/.npm/_npx/1415fee72ff6294b/node_modules/create-vite/dist/index.mjs:49:242)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errno: -1,
  syscall: 'copyfile',
  code: 'EPERM',
  path: '/home/cytech/.npm/_npx/1415fee72ff6294b/node_modules/create-vite/template-vanilla/_gitignore',
  dest: '/data/Documents/vite-project/.gitignore'
}

它尝试重新安装node和nvm,但没有修复任何问题。

2admgd59

2admgd591#

确保您对目标目录和/或.gitignore文件具有有效的写权限。

7hiiyaii

7hiiyaii2#

我尝试在Windows和Ubuntu之间共享的分区内设置vite项目。这意味着分区文件系统与更改权限不兼容,并且无法将文件复制到该分区。因此在该分区外启动项目解决了问题。

相关问题