Skip to content

[BUG] --scripts-prepend-node-path doesn't populate PATH #2808

@Gerrit-K

Description

@Gerrit-K

Current Behavior:

The flag --scripts-prepend-node-path, which is supposed to add the calling node executable to the PATH variable, doesn't seem to work. The directory isn't added.

Expected Behavior:

The directory of the calling node executable should be added to PATH.

Steps To Reproduce:

  • Download NodeJS and npm via nvm (in my case 14.15.5 and 7.6.0 respectively)
  • Create some skeleton with a package.json (in my case npm init nx-workspace)
  • Call node and npm in isolation to any shell environment:
    env -i bash --noprofile --norc -c '/path/to/.nvm/versions/node/v14.15.5/bin/node /path/to/.nvm/versions/node/v14.15.5/lib/node_modules/npm/bin/npm-cli.js --scripts-prepend-node-path run nx'
    (note: in order to fix sh: nx: command not found I've prepended the node call with PATH=$PATH:/path/to/.nvm/versions/node/v14.15.5/lib/node_modules/nx/bin)

Expected Behavior:

The help message of nx

Current Behavior:

env: node: No such file or directory

If you add a script with env or echo $PATH to the package.json you can see that PATH doesn't contain the directory to the calling node executable, so I assume it's not a bug of nx.

Environment:

  • macOS 11.1
  • NodeJS 14.15.5
  • npm 7.6.0

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingPriority 1high priority issueRelease 7.xwork is associated with a specific npm 7 releasepr: needs documentationpull request requires docs before merging

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions