question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: spawn yarnpkg ENOENT

See original GitHub issue

Can you reproduce the problem with latest npm?

I’m using yarn

Description

creating a new projet with create-react-app produces an error and the resulting projet is not working

Expected behavior

create-react-app testProject should finish without any errors and create a working project

Actual behavior

create-react-app testProject terminates with the following error

Installing react and react-dom using yarnpkg…

events.js:160 throw er; // Unhandled ‘error’ event ^

Error: spawn yarnpkg ENOENT at exports._errnoException (util.js:1022:11) at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32) at onErrorNT (internal/child_process.js:359:16) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9)

Environment

Run these commands in the project folder and fill in their results:

  1. npm ls react-scripts (if you haven’t ejected): > $ npm ls react-scripts testProj@0.1.0 /home/beac0n/dev/testProj └── react-scripts@0.8.5
  2. node -v: > $ node -v v7.4.0
  3. npm -v: > $ npm -v 4.1.1 > $ yarn --version 0.19.1

Then, specify:

  1. Operating system: Arch Linux
  2. Browser and version: Can’t start the project - getting errors:

Failed to compile.

Error in ./src/index.js Module not found: ‘react’ in /home/beac0n/dev/testProj/src

@ ./src/index.js 5:13-29

Error in ./src/App.js Module not found: ‘react’ in /home/beac0n/dev/testProj/src

@ ./src/App.js 10:13-29

Error in ./src/index.js Module not found: ‘react-dom’ in /home/beac0n/dev/testProj/src

@ ./src/index.js 9:16-36

Potential Fix

I could actually fix the issue, by executing: sudo ln -s /usr/lib/node_modules/yarn/bin/yarn.js yarnpkg in my /usr/bin/ directory.

It seems like create-react-app tries to use the command yarnpkg wich was not available on my arch linux system, although I installed yarn as described here: https://yarnpkg.com/en/docs/install#alternatives-tab

I’m not sure if this is an issue with my operating system, with yarn or with create-react-app. The issue only occurs when using create-react-app

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:20 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
itwasmattgreggcommented, Jun 30, 2017

I’m still having this issue even on Mac. I also tried creating a yarnpkg alias to yarn. npm v5.0.0 yarn v0.24.5 create-react-app v1.3.3

1reaction
gaearoncommented, Feb 14, 2017

Haha I just ran into this, thanks 😄 Fixed it by making my own alias from yarnpkg to yarn.

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - spawn yarnpkg ENOENT - Stack Overflow
"spawn yarnpkg ENOENT" usually indicates that the system cannot find the "yarnpkg" command. npm i ...
Read more >
How to fix the installing packages with yarn trace error spawn ...
The problem occurs when there is some problem with yarn. Either the installation is corrupted, there is no path set for the yarn,...
Read more >
failed to install expo package with error: spawn yarnpkg enoent
sudo apt update && sudo apt install --no-install-recommends yarn Note : Due to the use of nodejs instead of node name in some...
Read more >
Node.js – spawn yarnpkg ENOENT - iTecNote
NOTE: This error is almost always caused because the command does not exist, because the working directory does not exist, or from a...
Read more >
Failed to install expo package with error: yarnpkg exited with ...
at ChildProcess.cp.emit (C:\Users\AppData\Roaming\npm\node_modules\expo-cli\node_modules\cross-spawn\lib\enoent.js:34:29)
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found