loopbackio / loopbackio/loopback-next

Detection of yarn does not work (anymore?)

Open
#9,520 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
5.1k
Forks
1.1k
Avg merge
2d 21h
Merged PRs (30d)
27

Description

### Describe the bug

While loopback-cli tries to detect yarn a file `yarn-error.log` is generated. It seems that yarn cannot write to it's stdout when it is spawned as a child process by `lb4`.

### Logs

```shell
yarn-error.log:

Arguments:
/snap/node/7382/bin/node /snap/node/7382/bin/yarn.js help

PATH:
/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

Yarn version:
1.22.19

Node version:
19.9.0

Platform:
linux x64

Trace:
Error: EACCES: permission denied, write
at writeSync (node:fs:938:3)
at SyncWriteStream._write (node:internal/fs/sync_write_stream:26:3)
at writeOrBuffer (node:internal/streams/writable:392:12)
at _write (node:internal/streams/writable:333:10)
at Writable.write (node:internal/streams/writable:337:10)
at module.exports.Command.outputHelp (/snap/node/7382/lib/cli.js:58339:18)
at module.exports.Command.help (/snap/node/7382/lib/cli.js:58350:8)
at Object.run (/snap/node/7382/lib/cli.js:83978:13)
at run (/snap/node/7382/lib/cli.js:88392:22)
at /snap/node/7382/lib/cli.js:88722:16

npm manifest:
No manifest

yarn manifest:
No manifest

Lockfile:
No lockfile
```

### Additional information

This issue can be fixed by using `stdio: 'ignore'` instead of `stdio: false` here: https://github.com/loopbackio/loopback-next/blob/9d99c620e7dedad9099e1c83a068216c198749e0/packages/cli/lib/utils.js#L768

### Reproduction

none

Contributor guide

Open the contributing guide

Research direction

Start at packages/cli/lib/utils.js around line 768, where yarn is spawned during detection, and compare the current stdio setting with the issue's suggested change. Verify that yarn detection no longer produces yarn-error.log or an EACCES stdout failure when run as a child process by lb4; no reproduction or test file is provided.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.