【问题标题】:npm start isn't working, react-native appnpm start 不起作用,react-native 应用程序
【发布时间】:2021-02-02 02:12:54
【问题描述】:

我正在尝试构建 react-native 应用程序。 在 gitBash、windows10 上运行命令。 当我尝试运行“npm start”时,我收到此错误: 已修复,刚刚在rn-starter文件夹中重新安装了expo-cli,感谢您的回答:)

$ npm start
> @ start C:\Users\Liran\food
> expo start
'expo-cli' is not recognized as an internal or external command,
operable program or batch file.
This command requires Expo CLI.
Do you want to install it globally [Y/n]? Y
Installing the package 'expo-cli'...
npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path C:\Users\Liran\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\.xdl.DELETE\binaries\windows\adb\AdbWinApi.dll
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\Liran\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\.xdl.DELETE\binaries\windows\adb\AdbWinApi.dll'
npm ERR!  [OperationalError: EPERM: operation not permitted, unlink 'C:\Users\Liran\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\.xdl.DELETE\binaries\windows\adb\AdbWinApi.dll'] {
npm ERR!   cause: [Error: EPERM: operation not permitted, unlink 'C:\Users\Liran\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\.xdl.DELETE\binaries\windows\adb\AdbWinApi.dll'] {
npm ERR!     errno: -4048,
npm ERR!     code: 'EPERM',
npm ERR!     syscall: 'unlink',
npm ERR!     path: 'C:\\Users\\Liran\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\node_modules\\@expo\\.xdl.DELETE\\binaries\\windows\\adb\\AdbWinApi.dll'
npm ERR!   },
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path: 'C:\\Users\\Liran\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\node_modules\\@expo\\.xdl.DELETE\\binaries\\windows\\adb\\AdbWinApi.dll',
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\Liran\AppData\Roaming\npm-cache\_logs\2020-10-19T09_36_58_255Z-debug.log
Installing Expo CLI failed. You can install it manually with:
  npm install --global expo-cli
npm ERR! code ELIFECYCLE
npm ERR! errno 4294963248
npm ERR! @ start: `expo start`
npm ERR! Exit status 4294963248
npm ERR!
npm ERR! Failed at the @ start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Liran\AppData\Roaming\npm-cache\_logs\2020-10-19T09_36_58_348Z-debug.log

请帮助某人:)

【问题讨论】:

  • 你能检查你的packages.lock吗?
  • 如果您找到了解决方案,请在此处分享作为答案。

标签: react-native windows-10 git-bash expo


【解决方案1】:

Administrator 身份打开 windows 终端并运行命令:

install --global expo-cli

然后,您可以从项目的根目录运行 expo startnpm start 两者都可以。

【讨论】:

  • Expo cli 没有安装仅仅是因为您的 adb 仍在系统上使用以前安装的 expo cli,请从 TaskManager 中终止进程 adb.exe 或在重新启动系统后尝试相同的操作。
【解决方案2】:

您需要安装 Expo CLI 包。

见:https://docs.expo.io/workflow/expo-cli/

安装:

npm install -g expo-cli

如果您仍然遇到同样的错误,请执行以下两个步骤;

  1. 确保以管理员身份在终端上工作
  2. 如果您使用的是防病毒程序,请在尝试执行上述命令时将其停止。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-01-03
  • 2021-03-11
  • 1970-01-01
  • 1970-01-01
  • 2017-02-13
  • 2021-04-23
  • 1970-01-01
相关资源
最近更新 更多