Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

Run-script commands don't load environment vars with WSL #15

Open
boycce opened this issue Apr 15, 2018 · 0 comments
Open

Run-script commands don't load environment vars with WSL #15

boycce opened this issue Apr 15, 2018 · 0 comments

Comments

@boycce
Copy link

boycce commented Apr 15, 2018

Hi there,

Run-script doesn't seem to be setting environment variables when using WSL, but works fine for Mingw64.
Maybe it has to do with process.platform being set to 'linux' in contrast to Mingw64 setting it to 'win32'.

Node: 8.11.1
NPM: 5.8.0
OS: Windows 10 64bit

Steps to reproduce:

  1. npm config set script-shell C:\\Windows\\System32\\bash.exe
  2. Add to package.json: "scripts": { "printenv": "printenv" }
  3. npm run printenv

Result:

TERM=xterm-256color
SHELL=/bin/bash
NAME=compy
USER=ricky
HOSTTYPE=x86_64
PATH=...
_=/usr/bin/printenv
PWD=/mnt/c/Users/ricky
LANG=en_US.UTF-8
HOME=/home/ricky
SHLVL=2
LOGNAME=ricky

Expected:

npm_config_x and npm_package_x variables to also be set, so I can use them inside of run-script commands.

@boycce boycce changed the title Run-script commands don't load environment vars on WSL Run-script commands don't load environment vars with WSL Apr 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant