【发布时间】:2025-12-30 13:40:12
【问题描述】:
我第一次尝试在我的项目目录上安装 expo-cli,它工作正常。我可以使用expo init 在我的命令提示符中创建我的第一个反应本机应用程序,并使用expo start 运行该应用程序。但是现在当我有一些新项目要使用“expo”命令(如expo init 或expo start 或其他东西)时,它不再起作用了。当我尝试键入并输入 expo 命令时,它总是
'expo' is not recognized as an internal or external command, operable program or batch file.
现在,当我尝试使用 npm install -g expo-cli 更新 expo-cli 时,出现了错误警告。
npm ERR! code EPERM
npm ERR! syscall rename
npm ERR! path C:\Users\ACER\AppData\Roaming\npm\node_modules\expo-cli
npm ERR! dest C:\Users\ACER\AppData\Roaming\npm\node_modules\.expo-cli-foqoNR8w
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\ACER\AppData\Roaming\npm\node_modules\expo-cli' -> 'C:\Users\ACER\AppData\Roaming\npm\node_modules\.expo-cli-foqoNR8w'
npm ERR! [Error: EPERM: operation not permitted, rename 'C:\Users\ACER\AppData\Roaming\npm\node_modules\expo-cli' -> 'C:\Users\ACER\AppData\Roaming\npm\node_modules\.expo-cli-foqoNR8w'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'C:\\Users\\ACER\\AppData\\Roaming\\npm\\node_modules\\expo-cli',
npm ERR! dest: 'C:\\Users\\ACER\\AppData\\Roaming\\npm\\node_modules\\.expo-cli-foqoNR8w'
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\ACER\AppData\Local\npm-cache\_logs\2021-01-10T17_18_03_575Z-debug.log
这使我无法安装反应导航并使用“expo”命令创建一个新项目。我一直在搜索这个问题并试图解决它,但它在我尝试过的任何各种方式上都不起作用。我尝试重新安装 expo-cli 但它不起作用,我也尝试使用 yarn 但它仍然不起作用。我已经重新添加了 npm 的路径,甚至尝试重新安装 nodejs 并使用任何各种代码来更新和安装“expo-cli”,但它没有按预期工作。
有什么建议可以解决这个问题吗?
【问题讨论】:
-
Error: EPERM: operation not permitted,看来您需要以管理员权限运行命令提示符。 -
我之前尝试过(以管理员身份运行),但仍然是一个错误
标签: npm npm-install expo