npm install -g expo-cli 安装报错

npm install -g expo-cli , installation error

我使用以下命令安装 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\_logs20-08-03T05_57_40_929Z-debug.log 

如何解决这个错误?

我尝试使用 npm install 安装 npm,但它给出了以下警告。

npm WARN saveError ENOENT: no such file or directory, open 'F:\ucscrd year\Mobile Application Development\lec. notes\abc\package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'F:\ucscrd year\Mobile Application Development\lec. notes\abc\package.json'
npm WARN abc No description
npm WARN abc No repository field.
npm WARN abc No README data
npm WARN abc No license field.

up to date in 1.557s

因此我使用 npm install -g npm。安装成功

在我使用 npm install -g expo-cli 安装 expo-cli 之后 安装成功

尝试从终端运行npm install -g expo-cli