Failed to apply patch for package - javascript

I tried to run a new React Native (Android) project I got from somebody. When I run yarn install, the following error happens. How can I fix this ? I am new to react native.
patch-package: Applying patches...
**ERROR** Failed to apply patch for package react-native-confirmation-code-input
This error was caused because Git cannot apply the following patch file:
patches/react-native-confirmation-code-input+1.0.4.patch
This is usually caused by inconsistent whitespace in the patch file.

For anyone having this problem, this isn't a React-Native problem per se, it's because the library patch-package is trying to apply a patch for "react-native-confirmation-code-input" and fails.
This is mostly caused when the patch is created in Linux/MacOS and then used in Windows, because of EoL differences.

Related

How to fix VS Code unable to create a strapi app?

I'm Having an issue that ruins my entire development plans, And I don't think I'm even the problem!
There is an headless CMS program (open source) called Strapi, If you know the program then good, If not, Your more than welcome to try and tell me if you can help me with this problem.
I'm having trouble creating a Strapi app in VSCode.
The error that I'm receiving is:
You are running Node.js 18.4.0
Strapi requires Node.js >=14.19.1 <=16.x.x
Please make sure to use the right version of Node.
But, The fault isn't on me, I have 16.17.0 version of node installed, and without a trace of the 18.4 version specified on the error code.
I tried uninstalling node, Changing the dependencies in the launch.json file, Nothing worked!
So I Found the solution, the problem was with the version, the recommended 16.17.0 version of node not working with strapi, the 16.15.0 works actually.

React : Invalid hooks call without changing the React code

I am working on a full-stack app. My front-end, built on React was working fine. I installed cors for my back-end and it suddenly started giving me Invalid hook call error in my react app.
I tried uninstalling the dependency and also reverting to 2 old commits but it didn't work. I'm thinking it might be because of a peer dependency causing multiple versions of React. I tried npm ls react and npm ls react-dom but I have only one version for each i.e. 17.0.2.
The error message is also not helpful as I cannot understand where to start digging from. Attaching it below.
Here's the code repo (I couldn't figure out which part of code to share). The React code is inside the client directory. If someone can pinpoint me where to look or help me with the issue I'll be obliged. Thanks!
Error message

Error: Text data outside of root node - when installing cordova plugin

I sometimes get an error when trying to install any cordova plugin ionic (usually after around 6pm GMT+0).
These are with plugins from both npm and GitHub, and the error I get is:
Error: Text data outside of root node.
Line: 155
Column: 1
Char: "
The install command will be something along the lines of
ionic cordova plugin add cordova-plugin-network-information#1.3.1
It really does not matter what plugin it is, because as mentioned it happens for a number of them, they all get the same error. It will work perfectly ok in the morning, and then suddenly it shuts down.
I have tried on multiple computers, on multiple separate internet connections (from the UK), and I even have a script that reruns the commands if they fail, so it will attempt to install around 20 plugins continuously until they get installed for however long I run my script. I ran it for an hour constantly, and not a single one was installed.
I also checked the status of npm and GitHub if they were perhaps down, but they seemed to be up and running as usual...
Any ideas would be greatly appreciated
* Based on my comment which helped the asker, and which I was asked to publish as an answer:*
I don't know ionic at all, but I do have some experience with Cordova and never had any issues installing plugins, even on a corporate network.
Try to install the plugin without ionic.
cordova plugin add my.plugin.name
This error can be caused by an invalid AndroidManifest.xml file. After installing a plugin using ionic corvoda, my AndroidManifest.xml got a syntax error and I had this issue when building the APK.
After fixing the syntax error, the build finished successfully.

Bigcommerce Stencil 500 error

I am trying to get stencil set up on a trial store. I have a stencil theme set as default, installed node 4.4.0 as recommended, everything goes fine. Stencil start goes fine. but when I access the site through the browser I get the following error:
Debug: internal, implementation, error
TypeError: Uncaught error: self.assembler.getTranslations is not a function
at Paper.loadTranslations (/Users/oliverharoun/.nvm/versions/node/v4.4.0/lib/node_modules/#bigcommerce/stencil-cli/node_modules/#bigcommerce/stencil-paper/index.js:137:20)
at /Users/oliverharoun/.nvm/versions/node/v4.4.0/lib/node_modules/#bigcommerce/stencil-cli/node_modules/#bigcommerce/stencil-paper/index.js:62:18
at /Users/oliverharoun/.nvm/versions/node/v4.4.0/lib/node_modules/#bigcommerce/stencil-cli/node_modules/async/lib/async.js:718:13
at async.forEachOf.async.eachOf (/Users/oliverharoun/.nvm/versions/node/v4.4.0/lib/node_modules/#bigcommerce/stencil-cli/node_modules/async/lib/async.js:233:13)
at _parallel (/Users/oliverharoun/.nvm/versions/node/v4.4.0/lib/node_modules/#bigcommerce/stencil-cli/node_modules/async/lib/async.js:717:9)
at Object.async.parallel (/Users/oliverharoun/.nvm/versions/node/v4.4.0/lib/node_modules/#bigcommerce/stencil-cli/node_modules/async/lib/async.js:731:9)
at Paper.loadTheme (/Users/oliverharoun/.nvm/versions/node/v4.4.0/lib/node_modules/#bigcommerce/stencil-cli/node_modules/#bigcommerce/stencil-paper/index.js:60:11)
at respond (/Users/oliverharoun/.nvm/versions/node/v4.4.0/lib/node_modules/#bigcommerce/stencil-cli/server/plugins/renderer/responses/pencil-response.js:29:15)
at /Users/oliverharoun/.nvm/versions/node/v4.4.0/lib/node_modules/#bigcommerce/stencil-cli/server/plugins/renderer/renderer.module.js:49:18
at /Users/oliverharoun/.nvm/versions/node/v4.4.0/lib/node_modules/#bigcommerce/stencil-cli/server/plugins/renderer/renderer.module.js:246:24
All is working well for me in Node 4.4.5, but I have encountered these errors in the past. Deleting the node_modules folder and running npm i to do a fresh reinstall usually fixes the problem for me. If trouble persists, you may want to uninstall the global #bigcommerce/stencil-cli package and reinstall.
If you pull down the latest version of Stencil (just deployed in the last couple hours), you should have a fix for this. It was an issue introduced in a previous (recent) release.

Transformer hangs in recent versions of React Native when using Baobab

I started my React Native project with version 0.12.0 and Baobab. Everything worked great until React Native 0.14.2. In any version since then, the transform in the packager stops at 98% and the JS load fails.
I have used some of the advice in this github issue to determine that it's transforming a file in Baobab (baobab/dist/update.js or baobab/dist/watcher.js in different runs).
I have confirmed that Baobab is the issue by creating a clean React Native 0.16.0 install and only putting Baobab in it (with the required require)
At this stage, I'm not sure whether I should raise an issue with React Native or with Baobab, so I'm looking for advice on how to get some sort of error message that I can use to debug the issue and work out what's going wrong.
Ok. Worked this out myself:
By adding debug=babel to the environment the packager is running in, I got a huge amount of output and hidden in there was an error that .babelrc in the baobab package had an optional entry and the React Native packager doesn't understand optional. I deleted the .babelrc from the baobab package and everything works.

Categories

Resources