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

/bin/sh: 1: bun: not found #28201

Open
1 of 4 tasks
ThePlenkov opened this issue Sep 30, 2024 · 0 comments · May be fixed by #28202
Open
1 of 4 tasks

/bin/sh: 1: bun: not found #28201

ThePlenkov opened this issue Sep 30, 2024 · 0 comments · May be fixed by #28202
Assignees
Labels
scope: core core nx functionality type: bug

Comments

@ThePlenkov
Copy link

Current Behavior

I'm just trying to create a new workspace using npx create-nx-workspace command. I have the following error:

Error: Command failed: bun --version
/bin/sh: 1: bun: not found

    at checkExecSyncError (node:child_process:890:11)
    at execSync (node:child_process:962:15)
    at getPackageManagerVersion (/mnt/wsl/workspace/ubuntu/nx-cap-gen/node_modules/create-nx-workspace/src/utils/package-manager.js:101:50)
    at getPackageManagerCommand (/mnt/wsl/workspace/ubuntu/nx-cap-gen/node_modules/create-nx-workspace/src/utils/package-manager.js:39:23)
    at createSandbox (/mnt/wsl/workspace/ubuntu/nx-cap-gen/node_modules/create-nx-workspace/src/create-sandbox.js:20:84)
    at createWorkspace (/mnt/wsl/workspace/ubuntu/nx-cap-gen/node_modules/create-nx-workspace/src/create-workspace.js:19:61)
    at main (/mnt/wsl/workspace/ubuntu/nx-cap-gen/node_modules/create-nx-workspace/bin/create-nx-workspace.js:118:72)
    at Object.handler (/mnt/wsl/workspace/ubuntu/nx-cap-gen/node_modules/create-nx-workspace/bin/create-nx-workspace.js:103:11)
    at /mnt/wsl/workspace/ubuntu/nx-cap-gen/node_modules/yargs/build/index.cjs:1:8993 {
  status: 127,
  signal: null,
  output: [ null, '', '/bin/sh: 1: bun: not found\n' ],
  pid: 188003,
  stdout: '',
  stderr: '/bin/sh: 1: bun: not found\n'
}

Expected Behavior

It just should work. I don't have bun anywhere. I debugged the code and found following code:

/**
 * Detects which package manager was used to invoke create-nx-{plugin|workspace} command
 * based on the main Module process that invokes the command
 * - npx returns 'npm'
 * - pnpx returns 'pnpm'
 * - yarn create returns 'yarn'
 *
 * Default to 'npm'
 */
function detectInvokedPackageManager() {
    let detectedPackageManager = 'npm';
    // mainModule is deprecated since Node 14, fallback for older versions
    const invoker = require.main || process['mainModule'];
    // default to `npm`
    if (!invoker) {
        return detectedPackageManager;
    }
    for (const pkgManager of exports.packageManagerList) {
        if (invoker.path.includes(pkgManager)) {
            detectedPackageManager = pkgManager;
            break;
        }
    }
    return detectedPackageManager;
}

So the point is - my cwd is: /mnt/wsl/workspace/ubuntu/nx-cap-gen/node_modules/create-nx-workspace/bin and it does include bun because of uBUNtu.. But it doesn't mean at all it has to use bun manager.

This code needs to be reworked, sorry!

GitHub Repo

No response

Steps to Reproduce

Just create a folder containing bun in the path like i use:
'/mnt/wsl/workspace/ubuntu/nx-cap-gen'

  1. Create a new workspace inside using command:
    npx create-nx-workspace test

Make sure you have no bun available otherwise it will execute using bun.

Nx Report

Node           : 18.20.4
OS             : linux-x64
Native Target  : x86_64-linux
npm            : 10.7.0

nx                 : 19.8.2
@nx/js             : 19.8.2
@nx/jest           : 19.8.2
@nx/linter         : 19.8.2
@nx/eslint         : 19.8.2
@nx/workspace      : 19.8.2
@nx/devkit         : 19.8.2
@nx/eslint-plugin  : 19.8.2
@nx/plugin         : 19.8.2
@nrwl/tao          : 19.8.2
typescript         : 5.5.4
---------------------------------------
Local workspace plugins:
         nx-cap

Failure Logs

No response

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@jaysoo jaysoo self-assigned this Oct 14, 2024
@jaysoo jaysoo added the scope: core core nx functionality label Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: core core nx functionality type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants