Issue
I am new to react-native and trying to create a new app in the given location through following command ' npx react-native init travelApp' where travelApp is the name of the name but when I try to run it, i get following error as shown in the image
I try to change few settings at joined network, i even tried to restart the wifi and restart my Macbook but still the error persist? do I need rvm(Ruby version Manager) ? I have installed hombrew and Cocoapods along with node.js that are required. Below is the content of my .zhrsc file content.
`export PATH="$PATH:$HOME/Desktop/flutter/bin"
export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion`
I try to clean the cache, I tried to restart the wifi router and i even restarted the macbook but still the problem persist. I want create a new React Native App in vs code.
Solution
Given that the error persists even when trying to clear the npm cache, it seems like the invalid proxy configuration is deeply ingrained in your npm or Node.js setup.
Here's a more comprehensive approach to try and resolve this issue:
1. Completely Uninstall Node.js and npm
First, you'll want to completely uninstall Node.js and npm from your system. This ensures that any corrupted or misconfigured files are removed.
- Open Control Panel > Programs > Programs and Features.
- Find Node.js in the list of installed programs, select it, and click Uninstall.
- Follow the prompts to complete the uninstallation.
2. Manually Remove Remaining Files and Folders
After uninstalling, you should manually check for and remove any remaining Node.js or npm files and folders. Common locations to check include:
- C:\Program Files\nodejs
- C:\Users[YourUsername]\AppData\Roaming\npm
- C:\Users[YourUsername]\AppData\Roaming\npm-cache
- C:\Users[YourUsername].npmrc
Delete these folders if they still exist.
3. Remove Environment Variables
- Press Windows Key + X and select System.
- Click on Advanced system settings on the left.
- Click the Environment Variables... button.
- Under both User variables and System variables, find and remove any variables related to Node.js or npm, such as NODE_PATH or NPM_CONFIG_PREFIX.
4. Restart Your Computer
This ensures all changes take effect and any cached settings are cleared.
5. Reinstall Node.js and npm
Download the latest stable version of Node.js from the official website. The npm package manager is included with Node.js, so you don’t need to install it separately. Follow the installation instructions provided.
6. Verify the Installation
Open a new Command Prompt window and run:
bash node -v npm -v
This should display the installed versions of Node.js and npm, indicating that they are installed correctly.
7. Test npm Commands
Now try running your npm commands again to see if the issue is resolved.
This process should give you a clean slate, removing any corrupted or misconfigured settings that might have been causing the issue. If you still encounter issues after following these steps, there might be something else at play, possibly related to other software or configurations on your system.
Answered By - Hafiz Sajid Ashraf
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.