输入 npx create-expo-app 时,Expo 创建新项目出错

问题描述 投票:0回答:1

我尝试使用 Expo 创建一个 React Native 的新项目,但出现错误,我编写了以下命令:

npx create-expo-app ✔ What is your app named? … Test 
✖ Something went wrong in downloading and extracting the project files: npm pack expo-template-default@latest --dry-run --json exited with non-zero code: 1 
Error: npm pack expo-template-default@latest --dry-run --json exited with non-zero code: 1

我尝试重新安装 Node JS。现在是node v20.13.1,npm v10.8.0。我在 Ubuntu 22.04.4 LTS 上工作 没有任何帮助我。 当我编写 npm pack expo-template-default@latest --dry-run --json 然后看到以下答案: `

npm error code E404
npm error 404 Not Found - GET https://npm.pkg.github.com/expo-template-blank/-/expo-template-blank-51.0.27.tgz
npm error 404
npm error 404  'https://registry.npmjs.org/expo-template-blank/-/expo-template-blank-51.0.27.tgz' is not in this registry.
npm error 404 This package name is not valid, because 
npm error 404  1. name can only contain URL-friendly characters
npm error 404
npm error 404 Note that you can also install from a
npm error 404 tarball, folder, http url, or git url.
{
  "error": {
    "code": "E404",
    "summary": "Not Found - GET https://npm.pkg.github.com/expo-template-blank/-/expo-template-blank-51.0.27.tgz",
    "detail": "'https://registry.npmjs.org/expo-template-blank/-/expo-template-blank-51.0.27.tgz' is not in this registry.\nThis package name is not valid, because \n 1. name can only contain URL-friendly characters\n\nNote that you can also install from a\ntarball, folder, http url, or git url."
  }
}

`

有人遇到过这个问题吗? 我不知道如何解决它。 谢谢

react-native expo
1个回答
0
投票

尝试使用yarn而不是npx,它对我有用。如果yarn需要权限;使用 sudo 纱线。

所以应该是这样的:

sudo 纱线创建 expo-app appName --模板空白

© www.soinside.com 2019 - 2024. All rights reserved.