Wilfredo Casas
Wilfredo Casas

Reputation: 489

spawn yarnpkg ENOENT

This happens when I run expo install expo-permissions

It explicitly returns me

Installing 1 SDK 35.0.0 compatible native module using Yarn.

yarn add expo-permissions@~7.0.0

spawn yarnpkg ENOENT

Set EXPO_DEBUG=true in your env to view the stack trace.

Which is strange because I don't normally use Yarn. I use NPM to install dependencies.

I know this error has to do with my files or some path not being configured correctly. What I don't know is which path it is that I have to change and how to do so.

Please let me know if there is any other relevant info that I should add here.

Upvotes: 29

Views: 30448

Answers (9)

Shivanand Muddi
Shivanand Muddi

Reputation: 21

I've also faced the same error. I resolved by passing the flag --npm after the command.

expo install [package-name] --npm

Upvotes: 1

Max
Max

Reputation: 1

For nextjs you can try this as I found out that I am npx not yarn same as how I start npx expo start

npx expo update

Upvotes: 0

ogncmn
ogncmn

Reputation: 11

"spawn yarnpkg ENOENT" usually indicates that the system cannot find the "yarnpkg" command.

npm i -g corepack

This worked for me.

Upvotes: 1

Deepak Meena
Deepak Meena

Reputation: 111

Best solution for this would be using --npm flag

Example:

expo install pkname --npm,
expo update --npm,
expo upgrade --npm,

This is happened because you haven't executed yarn install or yarn command.

Upvotes: 11

Sheng Li
Sheng Li

Reputation: 117

Yes, I tried many ways and finally, I found the solution. The issue was different yarn package version. So first of all, you need to upgrade yarn version lastest.

open terminal and type the following.

  1. npm install --global yarn

  2. expo update

Hope this solve your issue.

Upvotes: 9

Gabriel Veiga Cardoso
Gabriel Veiga Cardoso

Reputation: 377

You can just pass the flag --npm after the command.

expo install [package-name] --npm

Upvotes: 28

Guilherme Benevides
Guilherme Benevides

Reputation: 647

I had the same problem as you my solution and you perform the installation of yarn via npm:
npm i -g yarn
I believe this error is caused because he cannot find the symbolic link for yarnpkg. When executing this command, yarn will be updated and linked.

Upvotes: 50

Giorgi Gvimradze
Giorgi Gvimradze

Reputation: 2129

This worked for me:

Latest Yarn Installation (from here)

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -

echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

sudo apt update && sudo apt install yarn

sudo apt update && sudo apt install --no-install-recommends yarn

Add this to your profile: export PATH="$PATH:/opt/yarn-[version]/bin" (the path may vary depending on where you extracted Yarn to) In the terminal, log in and log out for the changes to take effect

yarn --version checks if the version is latest (1.0+).

Then expo update <version> (ex: 36.0.0)

Concideration: Do not forget to check if you give attention to similar warning: "warning package-lock.json found. Your project contains lock files generated by tools other than Yarn."

Upvotes: 1

Mauricio
Mauricio

Reputation: 859

I had a similar problem. You should install yarn in your system, since that's what Expo CLI is trying to execute to install packages. For me my issue was that I did had yarn but I had an old version. I had to update my yarn version to 1.19.0. If you install this version it should work correctly.

I recommend using yvm to install and manage different versions of yarn. After you install yvm it is as easy to install yarn as yvm install <version>, so in this case you would do yvm install 1.19.0. And if you ever have to change versions because another project doesn't work with 1.19.0 (sometimes it happens) you can just install another version and change between versions by doing yvm use <version>.

Hope this helps!

Upvotes: 3

Related Questions