安装 React-Native 应用程序时出错无法解析从“npm pack expo-template-blank --dry-run”返回的 JSON。世博模板空白-45.0.3.tgz

Omk*_*shi 11 reactjs react-native

展示应用程序时显示此错误

\n
Error downloading and extracting template package: Error: Could not parse JSON returned from "npm pack expo-template-blank --dry-run".\nexpo-template-blank-45.0.3.tgz\n\nError: Unexpected token e in JSON at position 0\n\xc3\x97 Something went wrong while downloading and extracting the template.\n\nCan't read JSON file: G:\\ReactNative\\FoodApp\\app.json\n\xe2\x94\x94\xe2\x94\x80 Cause: Error: ENOENT: no such file or directory, open 'G:\\ReactNative\\FoodApp\\app.json'\n\xe2\x94\x9c\xe2\x94\x80 readAsync C:\\Users\\lenovo\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\node_modules\\@expo\\json-file\\src\\JsonFile.ts:158:13\n\xe2\x94\x9c\xe2\x94\x80 extractAndPrepareTemplateAppAsync C:\\Users\\lenovo\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\src\\commands\\utils\\extractTemplateAppAsync.ts:25:25\n\xe2\x94\x94\xe2\x94\x80 actionAsync C:\\Users\\lenovo\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\src\\commands\\initAsync.ts:287:19\n\nError downloading and extracting template package: Error: Could not parse JSON returned from "npm pack expo-template-blank --dry-run".\n\nexpo-template-blank-45.0.3.tgz\n\nError: Unexpected token e in JSON at position 0\n\xc3\x97 Something went wrong while downloading and extracting the template.\n\nCan't read JSON file: G:\\ReactNative\\FoodApp\\app.json\n
Run Code Online (Sandbox Code Playgroud)\n

我是本地反应新手,不知道如何解决这个问题

\n

小智 28

我和你有同样的问题。问题是你的 NPM 版本不正确,如果你有节点 16.#.#,你需要输入这个命令npm install -g npm它将更新你的 npm 并且它会工作。


Rob*_*kka 5

我也遇到了同样的问题,结果发现我没有最新的 npm 版本。尝试运行以下命令,然后重试:

npm 安装 npm@latest