【发布时间】:2019-02-01 04:04:52
【问题描述】:
我在创建我的第一个 react 本机应用程序时遇到错误。 我正在使用以下指南 - https://facebook.github.io/react-native/docs/getting-started.html
https://github.com/react-community/create-react-native-app
$ npm install -g create-react-native-app
--Worked fine
$ create-react-native-app my-first-native-app
--app created without errors
$ npm start
--gives error
Error: React native is not installed. Please run `npm install` in your project directory.
1:09:05: Error starting packager: Error: Couldn't start project. Please fix the errors and restart the project.
at C:\xdl\src\Project.js:1329:11
at Generator.next (<anonymous>)
at step (C:\reactJs-projects\my-first-native-app\node_modules\xdl\build\Project.js:1735:191)
at C:\reactJs-projects\my-first-native-app\node_modules\xdl\build\Project.js:1735:361
at <anonymous>
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-first-native-app@0.1.0 start: `react-native-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-first-native-app@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
尝试按照建议将 npm 降级到版本 4 进行修复,因为版本 5 存在错误。
npm i -g npm@4
我也尝试过最新的 npm,但都没有成功。
当我在我的项目目录上运行 npm install 时,而不是安装/更新我的包,它会给出以下错误
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://github.com/npm/npm/issues>
我看到所有在 node_modules 中下载的依赖项
对我错过了什么有什么建议吗?
我还注意到,在创建应用程序时(使用 create-react-native-app my-first-native-app)它还在控制台中添加了以下错误
yarn install v0.21.3
[1/4] Resolving packages...
warning jest-expo > jest > jest-cli > istanbul-api > istanbul-lib-hook@1.2.1: 1.2.0 should have been a major version bump
[2/4] Fetching packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/react-native-web-maps/-/react-native-web-maps-
0.1.0.tgz: invalid tar file".
info If you think this is a bug, please open a bug report with the information provided in "C:\\reactJs-projects
\\MyNewNativeApp\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Failed to install
谢谢!
【问题讨论】:
-
我尝试了@GosulsEz 解决方案,但没有奏效
标签: node.js reactjs react-native npm