Comments (14)
I have solved this problems by deleting yarn.lock, package.json, package-lock.json in C:\Users\ACER
from cli.
Alright, so let's keep the latest version of Yarn, as it's faster and more secure. Thanks for digging into this issue! 🙏
from cli.
hey @mcnaveen, can you run with --verbose
?
from cli.
Hi @szymonrybczak Sure, here it is.
$ npx react-native init watermelon --verbose
debug We couldn't find a package.json in your project. Are you sure you are running it inside a React Native project?
debug Failed to load configuration of your project. Only a subset of commands will be available.
debug Initializing new project
Welcome to React Native!
Learn once, write anywhere
debug Installing template from react-native@latest
yarn init v1.22.19
warning The yes flag has been set. This will automatically answer yes to all questions, which may have security implications.
success Saved package.json
✨ Done in 0.08s.
yarn config v1.22.19
success Set "nodeLinker" to "node-modules".
✨ Done in 0.09s.
yarn add v1.22.19
info No lockfile found.
[1/4] 🔍 Resolving packages...
error An unexpected error occurred: "Invalid URL".
info If you think this is a bug, please open a bug report with the information provided in "/private/var/folders/j8/6l83d1h53s1_10sqlgdn2drc0000gn/T/rncli-init-template-XI48fR/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
error Installing pods failed. This doesn't affect project initialization and you can safely proceed.
However, you will need to install pods manually when running iOS, follow additional steps in "Run instructions for iOS" section.
info 💡 To enable automatic CocoaPods installation when building for iOS you can create react-native.config.js with automaticPodsInstallation field.
For more details, see https://github.com/react-native-community/cli/blob/main/docs/projects.md#projectiosautomaticpodsinstallation
debug Error: Command failed with exit code 1: git commit -m Initial commit
On branch main
Initial commit
nothing to commit (create/copy files and use "git add" to track)
Run instructions for Android:
• Have an Android emulator running (quickest way to get started), or a device connected.
• cd "/Users/mcnaveen/Documents/dev/watermelon" && npx react-native run-android
Run instructions for iOS:
• cd "/Users/mcnaveen/Documents/dev/watermelon/ios"
• Install Cocoapods
• bundle install # you need to run this only once in your project.
• bundle exec pod install
• cd ..
• npx react-native run-ios
- or -
• Open watermelon/ios/watermelon.xcodeproj in Xcode or run "xed -b ios"
• Hit the Run button
Run instructions for macOS:
• See https://aka.ms/ReactNativeGuideMacOS for the latest up-to-date instructions.
and I can't find this log /private/var/folders/j8/6l83d1h53s1_10sqlgdn2drc0000gn/T/rncli-init-template-XI48fR/yarn-error.log
from cli.
Can you try with --npm
?
from cli.
I feel like this is more of a yarn issue. Because, With --npm
it seems to be working normally. The project is initialized.
Also, here is the yarn config.
$yarn config list
yarn config v1.22.19
info yarn config
{
'version-tag-prefix': 'v',
'version-git-tag': true,
'version-commit-hooks': true,
'version-git-sign': false,
'version-git-message': 'v%s',
'init-version': '1.0.0',
'init-license': 'MIT',
'save-prefix': '^',
'bin-links': true,
'ignore-scripts': false,
'ignore-optional': false,
registry: 'https://registry.npmjs.org',
'strict-ssl': true,
'user-agent': 'yarn/1.22.19 npm/? node/v18.13.0 darwin arm64',
lastUpdateCheck: 1707900363661,
nodeLinker: 'node-modules'
}
info npm config
{
editor: 'code',
'registry.npmjs.org/:_authToken': 'npm_XXXXXXXXXXXXXX'
}
from cli.
After initializing the project, can you install dependencies with Yarn inside project? Or do you have the same error as when initializing?
from cli.
Once the project is initialized, I can install the dependencies with yarn. It seems to be working fine.
from cli.
Hm, very strange. Unfortunately I cannot reproduce it myself :(
from cli.
Happy to provide more info if needed. Will try this on my Linux machine after I wake up. Think I face this only on Mac OS M1
from cli.
I see that there's a log file that probably contain more useful information about the failure:
info If you think this is a bug, please open a bug report with the information provided in "/private/var/folders/j8/6l83d1h53s1_10sqlgdn2drc0000gn/T/rncli-init-template-XI48fR/yarn-error.log".
Maybe you could run init
one more time and look inside this file?
from cli.
Hi @szymonrybczak This is strange, I can't reproduce this on my Linux machine. Happens only on Mac M1. Also, I can't access the log fie. It says file not found.
Linux mcnaveen 6.5.0-14-generic #14~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Nov 20 18:15:30 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
from cli.
So, here is the update on the issue.:
It of course fails with the yarn v1.22.19
. But after enabling the Yarn v4 via corepack
this seems to be working normally.
Here are the steps to set the yarn to v4. By default, the corepack is being shipped with node latest version.
- corepack enable
- yarn set version stable
- now run the init command again.
This time it'll use yarn v4 and works without any issue.
from cli.
this also happend on windows 11
from cli.
Related Issues (20)
- How to solve "Cannot find module 'react-native/cli" correctly? HOT 4
- Support for javascript template when initialize latest React Native HOT 3
- How can I get cli-platform-ios to recognize my M1-based Mac as a Destination/target-device? HOT 1
- 🚨 Security Vulnerability: ip npm package is unsafe for use as of v1.1.8 HOT 21
- Unable to start server in new window when using yarn with pnpm linker HOT 2
- FAILURE: Build failed with an exception.
- FAILURE: Build failed with an exception. Script '/home/xyz/Documents/CQ/projectName/node_modules/@react-native-community/cli-platform-android/native_modules.gradle' line: 375 HOT 1
- Implement support for Android activity aliases
- Not possible to specify macCatalyst UDID as run target
- Passing registry for different package managers HOT 5
- Health Check Plugin isn't executed when running `react-native doctor` HOT 2
- react-native run-android: Failed to install the app on the device. Error: Could not find the correct install APK file.
- How to build android release but with JS dev flag enabled? HOT 2
- On Android, app isn't opened automatically if applicationId is changed HOT 1
- API not working in React native android but working in ios. HOT 1
- Can CRNA change name inside project like NPX react-native init? HOT 1
- ✖ Could not create an empty Git repository, see debug logs with --verbose HOT 2
- Execution failed for task ':app:buildCMakeDebug[x86]' HOT 4
- Stuck at info JS server already running on Linux 22.04 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cli.