【发布时间】:2020-08-03 19:11:54
【问题描述】:
我安装 npm 以使用以下命令创建我的 react-native 项目
npm install -g expo-cli
但不幸的是我无法安装它。它给出了以下错误。
npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path C:\Users\kkawm\AppData\Roaming\npm\node_modules\.staging\@expo\xdl-f252ea11\binaries\linux\adb\adb
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\kkawm\AppData\Roaming\npm\node_modules\.staging\@expo\xdl-f252ea11\binaries\linux\adb\adb'
npm ERR! [OperationalError: EPERM: operation not permitted, unlink 'C:\Users\kkawm\AppData\Roaming\npm\node_modules\.staging\@expo\xdl-f252ea11\binaries\linux\adb\adb'] {
npm ERR! cause: [Error: EPERM: operation not permitted, unlink 'C:\Users\kkawm\AppData\Roaming\npm\node_modules\.staging\@expo\xdl-f252ea11\binaries\linux\adb\adb'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\Users\\kkawm\\AppData\\Roaming\\npm\\node_modules\\.staging\\@expo\\xdl-f252ea11\\binaries\\linux\\adb\\adb'
npm ERR! },
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\Users\\kkawm\\AppData\\Roaming\\npm\\node_modules\\.staging\\@expo\\xdl-f252ea11\\binaries\\linux\\adb\\adb',
npm ERR! parent: 'expo-cli'
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\kkawm\AppData\Roaming\npm-cache\_logs\2020-08-03T05_57_40_929Z-debug.log
我该如何解决这个错误?
【问题讨论】:
-
好吧,你可能之前没有完成安装,所以依赖链接坏了,你必须使用
npm install一次,然后尝试安装expo-cli。 -
可能是权限相关问题。尝试使用
sudo npm install -g expo-cli。 -
@KishanBharda sudo 不适合我。我正在开发 Windows 操作系统
-
哦,对不起。所以手动授予文件夹权限。
-
你试过以管理员身份运行cli吗?
标签: react-native npm npm-cache