Error: "detox-cli" package is not meant to be installed locally, exiting - react-native

I am trying to follow this link to use detox for e2e testing for my react native app. I did it successfully once, but I removed e2e folder, was conducting some experiments, now I am not able to run detox init -r jest
every time I run this line it gives me this error:
Error: "detox-cli" package is not meant to be installed locally, exiting...
HINT: Remove the local installation and reinstall it globally:
npm uninstall detox-cli
npm install -g detox-cli
I have tried the solution in the hint, but it didn't resolve the issue, any suggestions?
If I uninstall and run the command, same error shows up.
when I install it, this is what I see (node version and detox-cli version)
/Users/.../.nvm/versions/node/v14.17.0/bin/detox -> /Users/.../.nvm/versions/node/v14.17.0/lib/node_modules/detox-cli/cli.js
+ detox-cli#18.13.0
updated 1 package in 1.358s
-----Update:
I just tried this and worked:
/Users/.../.nvm/versions/node/v14.17.0/bin/detox init -r jest

Related

Execution failed for task ':react-native-location:compileDebugJavaWithJavac'

I upgraded all packages I am using on my app and then I decided to delete the node_module folder as well as package-lock.json. I then ran npm install and it installed everything but when I try run npx react-native run-android it fails with the following error:
> Execution failed for task ':react-native-location:compileDebugJavaWithJavac'.
I must state that when I installed all packages with npm install I had to run it with --force flag otherwise it would fail. Not sure if this has anything to do with the current error but just wanted to mention it.

How to run locally installed npm package with npx

I have the following folder structure with the locally installed Cypress module:
cypress-test-project
node_modules
cypress
tests.spec.js
As I read it in this article, npx helps to execute globally and locally installed packages:
Run a locally installed package easily
If you wish to execute a locally installed package, all you need to do
is type:
$ npx your-package
npx will check whether or
exists in $PATH, or in the local project binaries, and if
so it will execute it.
As I have Cypress installed in the node_modules folder, I tried to run the following command:
npx cypress open
This is what I get:
No version of Cypress is installed in:
C:\Users\main\AppData\Local\Cypress\Cache\9.5.1\Cypress
Please reinstall Cypress by running: cypress install
Cypress executable not found at:
C:\Users\main\AppData\Local\Cypress\Cache\9.5.1\Cypress\Cypress.exe
Platform: win32-x64 (10.0.22000) Cypress Version: 9.5.1
Why does npx stop after checking the PATH variable and not looking in the local folder?
Cypress always installs to that user-specific (global) location even if you install locally in the project.
It sounds like the install crashed part way.
Try removing and repeating.

Cannot find module ‘#expo/metro-config’ when trying to start the project with expo cli >= 4.8.0

I recently tried to launch my project on a new computer. I downloaded the source code from its repository and ran npm install to get all the needed packages.
However, when I run npm start or expo start:web, I get the error:
Cannot find module '#expo/metro-config'
I ran npm install #expo/metro-config and the install run without issue, but I still get the “Cannot find module '#expo/metro-config'” error.
The only post I saw regarding this error recommends editing the metro.config.js but I do not use one.
I am on SDK 42, and the project launches fine on my other computer. Any idea what is happening?
FYI, I use to perform this whole operation without any issue until now.
UPDATE:
I ran npm install -g #expo/metro-config and now I get the error Cannot find module 'resolve-from'
So it looks like maybe running npm install -g expo-cli doesn't actually install all the necessary packages? Could it be the issue?
I managed to make it "work" (get other missing packages errors down the line) by reverting to expo-cli 4.7.3. Anything from 4.8.0 and above will cause the error.
Something else is that on a fresh npm install, after running npm install -g expo-cli, if I try to create a project with expo init, I will get the error Error: Cannot find module 'kleur'. Running npm install kleur fix it, but maybe that's also a clue.

Cypress cannot run because this binary file does not have executable permissions

I was trying to create a new project in cypress and I got the following strange error message.
Steps:
npm init -y
npm install cypress --save-dev
I then did npx open cypress and I got the following message from my console
How do I fix this?
Cypress cannot run because this binary file does not have executable permissions here:
/Users/myName/Library/Caches/Cypress/7.5.0/Cypress.app/Contents/MacOS/Cypress
Reasons this may happen:
- node was installed as 'root' or with 'sudo'
- the cypress npm package as 'root' or with 'sudo'
Please check that you have the appropriate user permissions.
You can also try clearing the cache with 'cypress cache clear' and reinstalling.
----------
Platform: darwin (20.5.0)
Cypress Version: 7.5.0
You can do two things:
Run the command npm cypress cache clear and then again install cypress npm install cypress --save-dev and check.
Or, install npm globally without sudo using the command npm install -g. Then create a new folder and then run npm init, npm install cypress --save-dev and npx cypress open.
Do navigate to the cache directory by doing
cd /Users/myName/Library/Caches/
Here you have to delete Cypress directory completely by running the command
rm -rf Cypress
Now head over to your project directory and run the command
npx install cypress
Cypress will be installed in your system again. Next time you won't get any errors.
So, I had a chat with the dev team at Cypress and got the following answer. After reading the logs I had a feeling this might be the root cause. So please check you have the most up to date version of Node.js

RN Expo issue - Something when wrong installing JavaScript dependencies. Check your npm logs. Continuing to initialize the app

I am using react native and Expo. I am unable to build new app because after I use expo init appName it shows the following error.
Heres the full message:
📦 Using npm to install packages. You can pass --yarn to use Yarn instead.
√ Downloaded and extracted project files.
× Something when wrong installing JavaScript dependencies. Check your npm logs. Continuing to initialize the app.
✅ Your project is ready!
To run your project, navigate to the directory and run one of the following npm commands.
- cd Scanner
- npm start # you can open iOS, Android, or web from here, or run them directly with the commands below.
- npm run android
- npm run ios # requires an iOS device or macOS for access to an iOS simulator
- npm run web
I tried multiple times to create a blank project, also tried npm install to install failed/not downloaded libraries and continue after failure but it showed another error:
npm ERR! code Z_BUF_ERROR
npm ERR! errno -5
npm ERR! zlib: unexpected end of file
also tried npm cache verify that showed cache is ok Content verified: 3562 (252580364 bytes).
So, How can I solve this issue?
Problems related to npm installation are very common If you do any mistake in early installation, but is avoided. Learn more about npm tree.
Steps worked for me are :
npm cache clean --force
npm cache verify
npm -g uninstall expo-cli --save
npm install expo-cli --global
expo init app-name
cd app-name
npm start
Always run as administrator if working on Windows and in root directory.
The solutions above didn't work for me but if you use 'npm install' in the directory of the app you get a clue that you shuold try 'npm install --force'
err message
You should have all these files folders and files at the start of the project otherwise not all the dependencies have been installed which is why we were getting the problem.folder structure
After you have added --force to npm install you have all the dependencies installed. Now you can run the app with npm start.
Unfortunately, all the solutions described above didn't work on my machine...
Here is my latest solution for this problem...
This worked 100% on my machine...
Use npm i -g expo-cli
This will automatically add the required packages and also remove the unnecessary ones.
Yes, surely, you don't need to uninstall and re-install it again.
Just follow my steps.
And, you can create your expo project using expo init.
I hope my solution will help you out from this annoying problem....
I just did npm install and it worked for me, but I had do that every time I create a new expo project.
I also encountered this problem, and finally found that it was the problem of react native cli,I installed the latest version of react native cli,Expo is back to normal
This Error is regarding to the git account. expos need a git account to setup react native project
If you are using windows you need to install git in your local PC
after that open your Terminal and type this command
git config --global user.name "your_username"
git config --global user.email "your_email_address#example.com"
after that clone any github project to your local computer. it will ask to login to Github
after all these steps try expo init <projectname>
The simple way to settle that error is by using "expo-cli init app-name" instead of "expo init app-name".
I tried and worked perfectly for me. Hope it will help you guys.
i have faced a similar problem and running yarn set version 1.22.1 fix it
Run the Command Prompt as an administrator. And run the following command:
npx create-expo-app AwesomeProject