J'essayais de lancer un projet dans ReactNative en utilisant CLI et la commande que j'ai donnée était:
test d'initialisation npx react-native
La sortie ressemble à ceci:
{ "name": "testy", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", "test": "jest", "lint": "eslint ." }, "dependencies": { "react": "16.9.0", "react-native": "0.61.4" }, "devDependencies": { "@babel/core": "^7.7.2", "@babel/runtime": "^7.7.2", "@react-native-community/eslint-config": "^0.0.5", "babel-jest": "^24.9.0", "eslint": "^6.6.0", "jest": "^24.9.0", "metro-react-native-babel-preset": "^0.57.0", "react-test-renderer": "16.9.0" }, "jest": { "preset": "react-native" } }
Le fichier package.json ressemble à:
This will walk you through creating a new React Native project in C:\Users\Vipul\ReactProjects\testy Using yarn v1.19.1 Installing react-native... yarn add v1.19.1 info No lockfile found. [1/4] Resolving packages... warning react-native > fbjs-scripts > core-js@2.6.10: core-js@<3.0 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3. warning react-native > fbjs > core-js@2.6.10: core-js@<3.0 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3. warning react-native > create-react-class > fbjs > core-js@1.2.7: core-js@<3.0 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3. warning react-native > metro-babel-register > core-js@2.6.10: core-js@<3.0 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3. warning react-native > @react-native-community/cli > metro-core > jest-haste-map > fsevents@1.2.9: One of your dependencies needs to upgrade to fsevents v2: 1) Proper nodejs v10+ support 2) No more fetching binaries from AWS, smaller package size [2/4] Fetching packages... info fsevents@1.2.9: The platform "win32" is incompatible with this module. info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4] Linking dependencies... warning "react-native > metro-react-native-babel-transformer@0.56.3" has unmet peer dependency "@babel/core@*". warning " > react-native@0.61.4" has unmet peer dependency "react@16.9.0". [4/4] Building fresh packages... success Saved lockfile. success Saved 381 new dependencies. ... ... info Setting up new React Native app in C:\Users\Vipul\ReactProjects\testy info Adding required dependencies yarn add v1.19.1 [1/4] Resolving packages... warning jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > left-pad@1.3.0: use String.prototype.padStart() [2/4] Fetching packages... info fsevents@1.2.9: The platform "win32" is incompatible with this module. info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4] Linking dependencies... warning "@react-native-community/eslint-config > eslint-plugin-react-native@3.6.0" has incorrect peer dependency "eslint@^3.17.0 || ^4 || ^5". warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin@1.13.0" has incorrect peer dependency "eslint@^5.0.0". warning "@react-native-community/eslint-config > eslint-plugin-react@7.12.4" has incorrect peer dependency "eslint@^3.0.0 || ^4.0.0 || ^5.0.0". warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta". warning "@react-native-community/eslint-config > @typescript-eslint/parser@1.13.0" has incorrect peer dependency "eslint@^5.0.0". [4/4] Building fresh packages... success Saved lockfile. success Saved 179 new dependencies. ... ... info Adding required dev dependencies yarn add v1.19.1 [1/4] Resolving packages... [2/4] Fetching packages... warning Pattern ["@babel/core@^7.7.2"] is trying to unpack in the same destination "C:\\Users\\Vipul\\AppData\\Local\\Yarn\\Cache\\v6\\npm-@babel-core-7.7.2-ea5b99693bcfc058116f42fa1dd54da412b29d91-integrity\\node_modules\\@babel\\core" as pattern ["@babel/core@^7.0.0","@babel/core@^7.0.0","@babel/core@^7.0.0","@babel/core@^7.0.0","@babel/core@^7.0.0","@babel/core@^7.1.0","@babel/core@^7.1.0"]. This could result in non-deterministic behavior, skipping. warning Pattern ["@babel/runtime@^7.7.2"] is trying to unpack in the same destination "C:\\Users\\Vipul\\AppData\\Local\\Yarn\\Cache\\v6\\npm-@babel-runtime-7.7.2-111a78002a5c25fc8e3361bedc9529c696b85a6a-integrity\\node_modules\\@babel\\runtime" as pattern ["@babel/runtime@^7.0.0"]. This could result in non-deterministic behavior, skipping. info fsevents@1.2.9: The platform "win32" is incompatible with this module. info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4] Linking dependencies... warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin@1.13.0" has incorrect peer dependency "eslint@^5.0.0". warning "@react-native-community/eslint-config > @typescript-eslint/parser@1.13.0" has incorrect peer dependency "eslint@^5.0.0". warning "@react-native-community/eslint-config > eslint-plugin-react@7.12.4" has incorrect peer dependency "eslint@^3.0.0 || ^4.0.0 || ^5.0.0". warning "@react-native-community/eslint-config > eslint-plugin-react-native@3.6.0" has incorrect peer dependency "eslint@^3.17.0 || ^4 || ^5". warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
Maintenant, je veux savoir si ces avertissements vont pour affecter mon projet plus tard. Comment puis-je les supprimer et même si je ne les ai pas spécifiés, pourquoi RN utilise-t-il même une dépendance incorrecte ou non satisfaite?
Veuillez noter que j'ai essayé de créer un projet RN avant cela aussi et ici React Native - Impossible de résoudre le module `@ babel / runtime / helpers / interopRequireDefault` de 'index.js' est l'erreur à laquelle je suis resté coincé et j'ai alors commencé avec un nouveau projet.
Toute aide est appréciée.
3 Réponses :
ce correctif fonctionne pour l'erreur suivante.
avec npm:
npm run start --reset-cache
ou avec yarn:
yarn add @babel/runtime
et reconstruisez le projet avec
npm install --save @babel/runtime
Tout d'abord, non, cela ne devrait pas affecter votre projet. Réagir Native dépend d'un certain nombre de dépendances de base et de chaque mise à jour, il essaie de réduire ces dépendances de base. Cependant, cette réponse devrait mieux expliquer. P>
J'espère que cela vous aidera. P>
Juste au cas où d'autres personnes rechercheraient à nouveau cette erreur. Pour mon cas, je le résous en mettant à jour mes packages de fils.
npm install -g yarn