Giter Site home page Giter Site logo

Comments (14)

anamK4923 avatar anamK4923 commented on June 14, 2024 2

this also happend on windows 11 image

I have solved this problems by deleting yarn.lock, package.json, package-lock.json in C:\Users\ACER
image

from cli.

szymonrybczak avatar szymonrybczak commented on June 14, 2024 1

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.

szymonrybczak avatar szymonrybczak commented on June 14, 2024

hey @mcnaveen, can you run with --verbose?

from cli.

mcnaveen avatar mcnaveen commented on June 14, 2024

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.

szymonrybczak avatar szymonrybczak commented on June 14, 2024

Can you try with --npm?

from cli.

mcnaveen avatar mcnaveen commented on June 14, 2024

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.

szymonrybczak avatar szymonrybczak commented on June 14, 2024

After initializing the project, can you install dependencies with Yarn inside project? Or do you have the same error as when initializing?

from cli.

mcnaveen avatar mcnaveen commented on June 14, 2024

Once the project is initialized, I can install the dependencies with yarn. It seems to be working fine.

from cli.

szymonrybczak avatar szymonrybczak commented on June 14, 2024

Hm, very strange. Unfortunately I cannot reproduce it myself :(

from cli.

mcnaveen avatar mcnaveen commented on June 14, 2024

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.

szymonrybczak avatar szymonrybczak commented on June 14, 2024

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.

mcnaveen avatar mcnaveen commented on June 14, 2024

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.

mcnaveen avatar mcnaveen commented on June 14, 2024

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.

  1. corepack enable
  2. yarn set version stable
  3. now run the init command again.

This time it'll use yarn v4 and works without any issue.

from cli.

anamK4923 avatar anamK4923 commented on June 14, 2024

this also happend on windows 11
image

from cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.