facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.14k stars 24.32k forks source link

I can't install react-native. Unknown command: "init$1$1" #47485

Closed valery-lavrik closed 43 minutes ago

valery-lavrik commented 2 hours ago

Description

I copied the installation command from the official website. I have previously set up the environment, everything is fine. But the installation command gives an error.

npx @react-native-community/cli@latest init AwesomeProject

image

I understand that probably react-native is not to blame here, but I no longer know where to go for help. The error is not even Googled!

Steps to reproduce

npx @react-native-community/cli@latest init AwesomeProject

React Native Version

0.76.1

Affected Platforms

Build - Windows

Output of npx react-native info

no react-native

Stacktrace or Logs

⠹ Downloading template

error An unexpected error occurred: Command failed with exit code 1: npm init -y
Unknown command: "init$1$1"

To see a list of supported npm commands, run:
  npm help.

$ node -v v22.11.0

$ npm -v 10.9.0

$ npx -v 10.9.0

react-native-bot commented 2 hours ago

[!WARNING] Missing reproducer: We could not detect a reproducible example in your issue report. Please provide either:

cavadibrahimli1 commented 1 hour ago

I had same problem.

I reinstalled NPM, Nodejs. Then I tried this one in the C: folder, It worked for me.

npx @react-native-community/cli@latest init SampleApp --version 0.76.0

cavadibrahimli1 commented 1 hour ago

I had same problem.

I reinstalled NPM, Nodejs. Then I tried this one in the C: folder, It worked for me.

npx @react-native-community/cli@latest init SampleApp --version 0.76.0

I advice you to restart your device after doing the reinstallation phase

cortinico commented 43 minutes ago

I had same problem.

I reinstalled NPM, Nodejs. Then I tried this one in the C: folder, It worked for me.

npx @react-native-community/cli@latest init SampleApp --version 0.76.0

Yup this sounds like the right solution @valery-lavrik

If that doesn't help, could you open your same issue here:

https://github.com/react-native-community/cli/issues

The code where the failure happens is inside the Community CLI so if there is a bug there, it should be fixed inside the Community CLI code