Expo EAS not resolving sentry-expo. Are dependencies cached? - reactjs

I've joined the EAS preview, and I'm having problem when building my app. The build works perfectly with the classic build system. Here is a screenshot of the problem:
I think that EAS is caching the dependencies, but I'm not sure if this is the problem or how to clear their cache.
The first time I built the app, the process was slighty different:
As you can see, there is a "Install dependencies" step that isn't in the newer builds. That error of the install dependencies is already fixed.
I've sentry-expo in my package.json and in my app.config.js I have plugins: ["sentry-expo"],
I've also tried adding "cache": {"disabled": true} to the android build config with no success.
Does anyone know how to fix this problem?
Thanks!

This is likely a dependency management issue. In my case I was attempting to use yarn "pnp" which which doesn't support react-native at this time to my knowledge. I reverted that and was able to get past this.
My .gitignore
# yarn berry
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
My .yarnrc.yml
yarnPath: '.yarn/releases/yarn-berry.cjs'
nodeLinker: 'node-modules'

Try to install dependencies
npm i sentry-expo -s
yarn add sentry-expo
And rebuild eas build --platform ios --profile preview
This is working for me

Related

postcss 7.0.0 - 8.2.9 Severity: moderate Regular Expression Denial of Service

When creating a new project under create-react-app, you get warnings straight away regarding a vulnerability found in postcss.
Issue reported by npm: https://www.npmjs.com/advisories/1693
Related open issues can be found here:
https://github.com/postcss/postcss/issues/1574
https://github.com/facebook/create-react-app/issues/10945
The issue has been patched on postcss v8.2.10, but it's still present when creating new projects as react-scripts hasn't upgraded the dependency yet.
So, my problem here is I can no longer run builds as they fail due to the vulnerability.
Since I can't wait for them to get it patched before to keep working on my stuff (they seem to be aware of it since a year ago), is there some workaround that could be applied to solve it?
I tried adding a postcss resolution on package.json:
"resolutions": {
"postcss": "^8.2.10"
},
but that didn't land me far.
Any idea?
This article helped me.
https://www.npmjs.com/package/npm-force-resolutions.
To use resolutions you wrote you should force them by adding this script in package.json
"scripts": {
"preinstall": "npx npm-force-resolutions"
}
after that run npm install and it should overwrite all nested dependencies
Anyway it will not work due many dependencies. Good news is that support for postcss 8 is already merged and probably will be released soon https://github.com/facebook/create-react-app/issues/9664
Switching to Yarn makes this far simpler.
rm -rf ./node_modules
rm ./package-lock.json
edit your package.json :
add any other package versions to upgrade from npm / yarn audit here also
"resolutions":
{
"postcss": "^8.2.10"
},
yarn install then running yarn audit should yield the magic words:
0 vulnerabilities found - Packages audited: 999
✨ Done in 1.10s.
I managed to reduce the audit issues down to one moderate vulnerability due to the browserslist package in my post here:
https://stackoverflow.com/a/68046680/1669123
Updating postcss to version 8.x.x in resolutions results in build issues for me. I'm a web dev newcomer and guessing version 8 breaking changes for plugins is the culprit. Version 7.0.36 is the latest version 7 postcss that builds and runs for me. The changelog states that this version has the ReDoS fix backported from version 8. I can't seem to solve the browserslist package issue without it causing 'module not found' errors at runtime. I'm guessing we'll have to wait on the CRA team to update react-scripts for a more thorough solution.
Alternatively, you can solve it using yarn audit instead of npm.
yarn audit --groups postcss
This command will only ignore postcss package from the security check.

How to do a react build, when react-scripts is marked as dev-dependency

There is some license issue with one of the dependencies getting installed with react-scripts.
Project is created using CRA, so react-scripts is marked as dependency in package.json.
If I mark react-scripts as dev-dependency, since i don't need it for production, and install all the packages using 'npm install --production', I will not be able to use build script as react-scripts is not installed.
Browsing around this I see react-scripts should ideally be a Dev-dependency.
So just wanted to check if anyone can help here, how to use build script keeping react-scripts as Dev-dependency? is using webpack as a to bundle would be the only option here?
NPM and package.json initially were created for Node.js, which is intended to either run some scripts, or to run continuously. In this cases you might need some dependencies only when you are developing (for example some debuggers, or nodemon and so on), but don't need them in production.
In case of CRA, you don't need any dependencies on production, since you are building bunch of static files. Generally, you have some build pipeline, that will install all dependencies, build your static files and then transfer only built files to produciton (where only production dependencies may be installed again, or it can be another build step in pipeline). If you don't have such pipeline, you can install all dependencies, build on server and then delete node_modules.

Start React app fail on vscode by ESLint version

I have an issue that I cannot solve.
I'm using ESLint in VSCode for my all projects.
Now I created a new react app but when I run it (npm start or yarn start), it throws an error.
React app use ESLint 5.12.5, is lower version of mine.
I tried following the steps in the suggestion but ... it's not fixed.
Can anyone solve my issue?
I tried npm uninstall -g eslint, npm uninstall eslint, npm i ...bla..bla, removed my ESLint extension in my VSCode, and re-created react app. But the error has not been fixed.
I checked eslint -v, it said 5.14.1, but in the error notice, vscode said version 5.16.0 is in node-modules ##.
This is full error notice when I try yarn start or npm start:
> homework02#0.1.0 start E:\Extenal Code\Hoc JS\ReactJS-iViettech\homework02
> react-scripts start
There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.
The react-scripts package provided by Create React App requires a dependency:
"eslint": "5.12.0"
Don't try to install it manually: your package manager does it automatically.
However, a different version of eslint was detected higher up in the tree:
E:\Extenal Code\Hoc JS\node_modules\eslint (version: 5.16.0)
Manually installing incompatible versions is known to cause hard-to-debug issues.
If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That will permanently disable this message but you might encounter other issues.
To fix the dependency tree, try following the steps below in the exact order:
1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
2. Delete node_modules in your project folder.
3. Remove "eslint" from dependencies and/or devDependencies in the package.json file in your project folder.
4. Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:
5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
6. Check if E:\Extenal Code\Hoc JS\node_modules\eslint is outside your project directory.
For example, you might have accidentally installed something in your home folder.
7. Try running npm ls eslint in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed eslint.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.
I just solved this issue, the error says:
The react-scripts package provided by Create React App requires a dependency:
"eslint": "5.12.0" (in my case "^5.16.0")
but also says you have another version at package.json that's
E:\Extenal Code\Hoc JS\node_modules\eslint (version: 5.16.0) in my case was 6.1.0
so my solution was:
I searched for the dependency called eslint and updated the version similar to Create React App expected "eslint": "^5.12.0" (in my case "eslint": "^5.16.0") at package.json
Then run npm install and now you can run npm start... if you have troubles with slint-plugin-import just update the version as well, additional you can try installing locally instead of global with --save.
I believe this is an ongoing issue with create-react-app and eslint as detailed at:
https://github.com/wesbos/eslint-config-wesbos/issues/17
There are a number of suggestions there, though I'm hoping they will put a more permanent fix in place.
In my case it works like below:
Create New Project or clone form vcs.
Create .eslintrc.json file by yourself. Do not use Ctrl+Shift+P ->Eslint:create eslint configuration.
Try searching for eslint and change the version to the required version in the package.json file of eslint. 5.12.0 in your case.
Just try clearing cache and everything will come into normal usage you can use npx create-react-app project-folder-name, this worked for me.
Use this cmd in your terminal
cmd -> npm cache clean —force
there is different process to make it work just have to follow two installations for the future projects too if you like you can use this too and can work for your projects, cmd line is mentioned below :
cmd 1-> create-react-app my-app --scripts-version #nomoreanalog/react-scripts-eslintless
cmd 2-> npm install --save-dev babel-plugin-styled-components

Requested item is quarantined in Reactjs

I am trying to run the command npx create-react-app under a corporate registry. The problem is that the element sockjs#0.3.18 is not available and therefore it stalls the installation; however, the element sockjs#0.3.17 is. Is there any way I can run that command by specifying it should install a different version of sockjs?.
Using npm ls sockjs, I see this is a dependency of react-scripts#1.1.4 / webpack-dev-server#2.9.4
└─┬ react-scripts#1.1.4
----└─┬ webpack-dev-server#2.9.4
--------└── sockjs#0.3.18
There's an option in create-react-app to use a nonstandard version of react-scripts:
--scripts-version <alternative-package>
This should work:
npx create-react-app --scripts-version 0.9.5 app
0.9.5 is the latest version that depends on an earlier sockjs.
I found this by looking up the package.json of webpack-dev-server and then react-scripts that had appropriately downgraded versions. (I did it manually on GitHub release pages... anyone know a better tool for that?)
Alternative approaches:
Get the updated sockjs approved in your corporate registry :)
Assuming the difference between sockjs#0.3.18 and sockjs#0.3.17 is immaterial as for as create-react-app goes (no guarantees), you could probably npm install create-react-app, find the bit in the source code (node_modules/create-react-app/create-react-app.js) that downloads react-scripts, and hack it to point to your own fork of the latest react-scripts with a changed version number for webpack-dev-server (1.16.4). Not recommended!

React Native "The expo SDK requires Expo to run. .... this code is not running on Expo."

I am coding with React Native. I don't see that when I first create react-native app for check running. When I implements my code see that. My purpose is generate apk.
app.json
build.gradle
index.js (index.android.json)
App package.json
Solved
Result: I solved my problem with npm install. I would like say many month after.
If anyone's getting this error after upgrading Expo, try restarting your simulator - that fixed it for me.
Here is my experience if someone using expo sees those error message.
I accidentally installed expo manually in my project which was version 29.0.0.
I was using version 28.0.0 of expo sdk, so it may have crashed inside.
What I did:
manually upgrade sdkVersion of app.json to 29.0.0.
change sdk version to 29.0.0 for react-native.
Had exactly the same error - fresh machine, fresh npm, only one version of expo installed.
Turns out, expo requires you to build it as an app before it can send it to the expo app properly (at least on Android). This is easiest done by:
Adding an "android" section to app.json, with the contents "package": "uk.co.yourcompany.yourpackagename" (this is required by android packages. It can be complete garbage, but should follow that format - a backwards domain name)
running expo build:android and following the instructions to sign up to expo's servers and build the app
then restarting expo start
Not sure if this is documented anywhere though, so may be a new thing?
Another thing to try is to move your node_modules folder away (or maybe delete it, up to you) and re-run npm install
According to the official tutorial: https://facebook.github.io/react-native/blog/2017/03/13/introducing-create-react-native-app.html
If you want to use expo in your application, you must create it in the following way
npm i -g create-react-native-app
create-react-native-app my-project
cd my-project
npm start
This will start the React Native packager and print a QR code. Open it in the Expo app to load your JavaScript.
as I see your code has files that are not necessary, such as build.gradle and index.js, the structure that create-react-native-app creates is different and easier to use
I was getting the same error after updating the expo-cli to version 3.0.6.
By looking at my package.json I noticed the expo-cli version installed on my computer is not the same as package.json. so I changed it to "expo-cli": "^3.0.6" and ran npm install || yarn, then the error disappeared!

Resources