0

我使用以下命令安装 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 

我如何解决这个错误?

4

2 回答 2

0

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

于 2020-08-03T11:11:54.453 回答
0

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

npm WARN saveError ENOENT: no such file or directory, open 'F:\ucsc\3rd 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:\ucsc\3rd 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. 它安装成功

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

于 2020-08-03T10:08:56.620 回答