Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throws error about missing yarn #34

Open
Tobbe opened this issue Oct 25, 2019 · 1 comment
Open

Throws error about missing yarn #34

Tobbe opened this issue Oct 25, 2019 · 1 comment

Comments

@Tobbe
Copy link

Tobbe commented Oct 25, 2019

I don't have yarn installed, so I tried using npm instead.

npm i -g netlify-cli # Make sure you have the [Netlify CLI](https://github.com/netlify/cli) installed
git clone https://github.com/netlify/create-react-app-lambda ## clone this repo
cd create-react-app-lambda ## change into this repo
npm install # install all dependencies

All of the above commands runs just fine. But then, when I try to run ntl dev, I get this output

$ ntl dev
◈ Netlify Dev ◈
◈ Starting Netlify Dev with create-react-app
◈ Function builder netlify-lambda detected: Running npm script build:lambda
 »   Warning: ◈ This is a beta feature, please give us feedback on how to
 »   improve at https://github.com/netlify/cli/
'yarn' is not recognized as an internal or external command,
operable program or batch file.
{ Error: spawn yarn ENOENT
    at notFoundError (C:\Users\tobbe\AppData\Roaming\npm\node_modules\netlify-cli\node_modules\cross-spawn\lib\enoent.js:6:26)
    at verifyENOENT (C:\Users\tobbe\AppData\Roaming\npm\node_modules\netlify-cli\node_modules\cross-spawn\lib\enoent.js:40:16)
    at ChildProcess.cp.emit (C:\Users\tobbe\AppData\Roaming\npm\node_modules\netlify-cli\node_modules\cross-spawn\lib\enoent.js:27:25)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:239:12)
  code: 'ENOENT',
  errno: 'ENOENT',
  syscall: 'spawn yarn',
  path: 'yarn',
  spawnargs: [ 'start' ] }
{ Error: spawn yarn ENOENT
    at notFoundError (C:\Users\tobbe\AppData\Roaming\npm\node_modules\netlify-cli\node_modules\cross-spawn\lib\enoent.js:6:26)
    at verifyENOENT (C:\Users\tobbe\AppData\Roaming\npm\node_modules\netlify-cli\node_modules\cross-spawn\lib\enoent.js:40:16)
    at ChildProcess.cp.emit (C:\Users\tobbe\AppData\Roaming\npm\node_modules\netlify-cli\node_modules\cross-spawn\lib\enoent.js:27:25)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:239:12)
  code: 'ENOENT',
  errno: 'ENOENT',
  syscall: 'spawn yarn',
  path: 'yarn',
  spawnargs: [ 'start' ] }

C:\Users\tobbe\AppData\Roaming\npm\node_modules\netlify-cli\node_modules\netlify-redirector\lib\redirects.js:116
      throw ex;
      ^
abort({"code":"ENOENT","errno":"ENOENT","syscall":"spawn yarn","path":"yarn","spawnargs":["start"]}) at Error
    at jsStackTrace (C:\Users\tobbe\AppData\Roaming\npm\node_modules\netlify-cli\node_modules\netlify-redirector\lib\redirects.js:1070:13)
    at stackTrace (C:\Users\tobbe\AppData\Roaming\npm\node_modules\netlify-cli\node_modules\netlify-redirector\lib\redirects.js:1087:12)
    at process.abort (C:\Users\tobbe\AppData\Roaming\npm\node_modules\netlify-cli\node_modules\netlify-redirector\lib\redirects.js:8415:44)
    at process.emit (events.js:182:13)
    at processEmit [as emit] (C:\Users\tobbe\AppData\Roaming\npm\node_modules\netlify-cli\node_modules\signal-exit\index.js:155:32)
    at emitPromiseRejectionWarnings (internal/process/promises.js:105:20)
    at process._tickCallback (internal/process/next_tick.js:69:34)

Removing yarn.lock fixes the issue and makes everything run fine on localhost. Since I'm not using yarn locally, I also updated netlify.toml to use npm instead of yarn for building on netlify's servers.

Took a while to figure out why it wasn't working. (Having not worked with Netlify Dev before it wasn't exactly obvious that your lockfile determines what tools it tries to use 😉)

I guess this issue is semi-related too: netlify/cli#328

Anyway. I suggest removing yarn.lock from the repo and instead be more specific about exactly what package versions to use in package.json. Alternatively you could document that yarn needs to be installed for this to work, and why, and ways to work around it.

@swyxio
Copy link
Contributor

swyxio commented Nov 4, 2019

PR welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants