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

[BUG] '"-S"' is not recognized as an internal or external command #3719

Closed
1 task done
huan opened this issue Sep 5, 2021 · 2 comments
Closed
1 task done

[BUG] '"-S"' is not recognized as an internal or external command #3719

huan opened this issue Sep 5, 2021 · 2 comments
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release

Comments

@huan
Copy link

huan commented Sep 5, 2021

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I want to put --no-warnings --loader ts-node/esm --experimental-vm-modules to node args, so we use env -S:

 #!/usr/bin/env -S node --no-warnings --loader ts-node/esm --experimental-vm-modules 

https://github.com/huan/sidecar/blob/28461a00a1553f6a0008f39b279899971781a767/bin/sidecar-dump.ts#L1

However, this will generate the following node_modules/.bin files:

IF EXIST "%dp0%\-S.exe" (
  SET "_prog=%dp0%\-S.exe"
) ELSE (
  SET "_prog=-S"
  SET PATHEXT=%PATHEXT:;.JS;=;%
)
if (Test-Path "$basedir/-S$exe") {
  # Support pipeline input
  if ($MyInvocation.ExpectingInput) {
    $input | & "$basedir/-S$exe" node --no-warnings --loader ts-node/esm --experimental-vm-modules "$basedir/../sidecar/dist/esm/bin/sidecar-dump.js" $args
  } else {
    & "$basedir/-S$exe" node --no-warnings --loader ts-node/esm --experimental-vm-modules "$basedir/../sidecar/dist/esm/bin/sidecar-dump.js" $args
  }
  $ret=$LASTEXITCODE
}

Expected Behavior

The -S.exe and -s$exe are both not correct, which should be set to node.exe

Steps To Reproduce

Under windows:

  1. npm install sidecar@0.15.27
  2. run
PS> type .\node_modules\.bin\sidecar-dump.cmd
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0

IF EXIST "%dp0%\-S.exe" (
  SET "_prog=%dp0%\-S.exe"
) ELSE (
  SET "_prog=-S"
  SET PATHEXT=%PATHEXT:;.JS;=;%
)

endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" node --no-warnings --loader ts-node/esm --experimental-vm-modules "%dp0%\..\sidecar\dist\esm\bin\sidecar-dump.js" %*
  1. See error IF EXIST "%dp0%\-S.exe" ( which is not correct: -S.exe should be node.exe

Environment

  • OS: Windows
  • Node: 16
  • npm: 7.15.1

Link to:

@huan huan added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Sep 5, 2021
@wraithgar
Copy link
Member

This is the repo for npm issues. It looks like this is a problem with using node itself. I believe issues for that are to be created at https://github.com/nodejs/node

@huan
Copy link
Author

huan commented Sep 16, 2021

No, it's not the node problem but the npm cmd-shim

See:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

No branches or pull requests

2 participants