Skip to content

node_modules bin directory missing from PATH for options-configured working directory #164

Description

@shanedg

Hello,

When passing a package working directory via nodeOptions, the spawned process $PATH includes the node_modules bin directory for the parent process package working directory but not for a configured one.

Similar to #86 but not an apparent ordering problem:
the expected path/to/package/node_modules/.bin directory is missing from the $PATH.

// run from path/to/parent/process/cwd
import { resolve } from 'node:path';
import { exec } from 'tinyexec';

const { stdout: spawnedPathEnv } = await exec('node', ['-p', 'process.env.PATH'], {
  nodeOptions: { cwd: resolve('path/to/package') }
});

console.log(spawnedPathEnv);

// the spawned process executes at the passed cwd so I also
// expect PATH to include 'path/to/package/node_modules/.bin'
// but only includes 'path/to/parent/process/cwd/node_modules/.bin'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions