【问题标题】:npm install -g expo-cli , installation errornpm install -g expo-cli ,安装错误
【发布时间】: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


【解决方案1】:

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

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。安装成功

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

【讨论】:

    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-02-13
      • 2021-08-25
      • 2020-03-11
      • 2021-02-13
      • 2017-11-09
      • 1970-01-01
      • 2020-12-19
      相关资源
      最近更新 更多