React Native, unable to clean gradlew - javascript

I'm trying to clean my android gradlew file by cd android and ./gradlew clean but it's showing that error, can anyone tell me how to clean it without getting that error?? please help
Task :react-native-localization:clean FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-localization:clean'.
> java.io.IOException: Unable to delete file 'C:\Users\DAWOR\Go-polo-master\node_modules\react-native-localization\android\build'

cd android
gradlew clean
no need for ./ if your in the android directory unless your using linux as for the error this just means it could not delete the specified folder could be due to permissions or a file in the folder still being in use by something
i would suggest deleting the folder your self then rerunning the command this can happen if you still have metro or the emulator open if a file is still in use by something

Related

unexpected end of json input error when I try to create a react app

I keep getting the error of unexpected end of json input when I run the command "npx create-react app". below is the error message:
error An unexpected error occurred: "C:\Users\Josh\AppData\Local\Yarn\Cache\v6\npm-#svgr-babel-plugin-add-jsx-attribute-5.4.0-81ef61947bb268eb9d50523446f9c638fb355906-integrity\node_modules\#svgr\babel-plugin-add-jsx-attribute\.yarn-metadata.json: Unexpected end of JSON input".
info If you think this is a bug, please open a bug report with the information provided in "C:\Users\Josh\Documents\edconnect-react\tic-tac-toe\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
info There appears to be trouble with your network connection. Retrying...
Please how do I fix this?
As notes above yarn cache clean should deal with most issues, however today I came across this situation and none of these worked for me:
yarn cache clean
yarn cache clean --force
yarn cache clean --mirror
yarn cache clean --all
The issue was that by running npx, or perhapse an npm/yarn command earlier there was package.json file that was created in my home directory with nothing in it
by removing this file via
rm ~/package.json
yarn (and npx commands that invoke yarn) were able to run successfully in my project

React Native, Failed to launch emulator. Reason: No emulators found as an output

I'm trying to run my react native app in emulator by using command react-native run-android but it's throwing that error
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 44s
info Connecting to the development server...
warn Failed to connect to development server using "adb reverse": spawnSync /Opt/Android/platform-tools/adb ENOENT
info Starting the app...
The system cannot find the path specified.
error Failed to start the app. Run CLI with --verbose flag for more details.
Error: Command failed: /Opt/Android/platform-tools/adb shell am start -n com.reactproject/com.reactproject.MainActivity
at makeError (C:\Users\Danger World\ReactProject\node_modules\execa\index.js:174:9)
I already setup my android studio and sdk manager, avd manager like it's shown in doc also I already set path but it's still showing that error, anyone know why? Can anyone help please?
You can fix it by using the command :
react-native doctor
This command shows all issues that need to be fixed.
Press f to fix the issues and don't forget to restart your windows
And after then open the emulator before running your project.
Once emulator opened,
run command:
react-native run-android
After fixed:
Don't forget to give me an upvote if that's work.
In My Case, I have to re-run the command in the same terminal where you are trying to run npx react-native run-android
Step 1. paste the source command first
source ~/.bash_profile OR source ~/.bashrc
Step 2. RUN Next command
npx react-native run-android
set your AVD manager path and JDK path like this , also you have to add Android Home path

React native can't run in ios by command but it can run in Xcode?

I used two libraries: "native-base" and "react-native-elements" but when I used it, I could not use the command react-native run-ios. But when I open the Xcode project, it can run and work as well.
This is my error below when I try to use the command react-native run-ios:
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening DesignComponents.xcodeproj
One more error:
The following build commands failed:
Analyze /Users/my_path_project/node_modules/react-native/React/Base/RCTAssert.m normal x86_64
(1 failure)
I try to resolve it by clean cache, clean folder node_modules and something that I can, but it's not working.

expo init <project name> throwing npm ERROR (windows OS)

Just started with expo and React-Native and when I run
expo init ProjectName
I am getting an error stating:
Unexpected end of JSON input while parsing near '...,"version":"7.0.0-bet'
Process exited with non-zero code: 1
Set EXPO_DEBUG=true in your env to view the stack trace.
When I add the said thing in env (using set EXPO_DEBUG=true on windows), I get the following error:
Error: Process exited with non-zero code: 1
at ChildProcess.child.on (C:\Users\mohit\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\spawn-async\build\spawnAsync.js:39:21)
at ChildProcess.emit (events.js:182:13)
at ChildProcess.cp.emit (C:\Users\mohit\AppData\Roaming\npm\node_modules\expo-cli\node_modules\cross-spawn\lib\enoent.js:40:29)
at maybeClose (internal/child_process.js:962:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
It's something related to 'spawn-async'. I was also getting issues with 'spawn' sometime earlier while creating a node-server...but I resolved that there and then using 'exec' instead. Tried to find this on expo forums and even in react-native issues but couldn't find a solution. Can someone plz suggest something? Is it some "windows" thing only or something related to npm releases?
P.S: I also ran create-react-native-app ProjectName and again got a similar kind of error about end of JSON input!
Now I know what can be the issue, it can be just the trivial one:
Please update node an npm to the newest available version and please init you project again in different directory.
You'll need to have Node.js (version 10 or newer) installed on
your computer. Download the latest version of Node.js.
Additionally, you'll need Git to create new projects with Expo
CLI. You can download Git from here.
Make sure that you have installed these two things in your device.
Go to doc for expo installation
in my case. make sure you have yarn installed and update tour android studio packages, for it to work

EPERM: operation not permitted, lstat when running ng build

I'm getting an ERROR when trying to run ng build on my angular 4 app.
EPERM: operation not permitted, lstat '<dist directory>'
Has anyone encountered this issue?
TIA
I had the same problem.
As #Mauricio De La Quintana said, the problem is permission.
In my case (Windows environment), I solved the problem by removing the read-only property from the Repos folder and adding write permission to the Everyone user.
This probably a permission issue, just restart your IDE with admin permissions!
In my case I had to restart VsCode as administrator.
While running npm run build - I received error
Open Task Manager -> Select Chrome - > End Task
-> Select VSCode -> End Task
Opened the Project again -> Run npm run Build ---> worked for me
This has happened in my ASP.NET projects. For me this has happened for one of two reasons.
This can be a permission problem so you need to run Command Prompt as Admin.
a. Press win to open the start menu. Type in cmd to search for Command Prompt.
b. Press ctrl + shift + enter to launch Command Prompt as administrator.
This can happen when you build your web project in Visual Studio(or another IDE) and it is currently running.
a. This is a simple fix click the stop debugging and then try 'ng build' again.
Just restarted the VSCode and ran in admin. That solves my problem.
I saw this problem when running IISNODE...
Solution: Ensure that AppPool Identify from IIS has read permissions all the way from root of harddrive to website files.
Full answer is here https://github.com/tjanczuk/iisnode/issues/247
I had this issue while running a build on windows at the same time WSL was running in the directory. The issue was resolved by closing the WSL terminal.
Simply follow these steps
Restart VS Code
run npm run build
I think it is a permission problem, when you do ng build you also delete the previous files. I suggest using
sudo chown -R youruser /pathAngularApp
I had the same problem, and it was related to what #goku_da_master commented, I had the vueJs application running even when my VsCode stopped, I figured it out from the task manager and fixed it like this:
I opened the task manager
I searched if Node.js was running
Right click on the Node.js process
Finish Task
"npm run dev" again
I experienced the same problem. The fix for me was to install the correct node version that the project was requiring (an older one), then closing all terminal windows in VS Code, and relaunching VSC.
To switch node versions, I installed nvm and had to make sure the default alias was pointing towards the exact node version I wanted.
Error : Error: EPERM: operation not permitted, lstat 'C:\Users\Administrator'
We encountered this error after the Windows update.
This Solution worked for me;
Go to C:\Users\Administrator
Rename the file NTUSER.DAT as NTUSER-old.DAT

Categories