Skip to content

When running inside a headless process such as within Visual Studio's NPM Task Runner, any ng command throws an error due to process.stdin not being implemented #4870

Closed
@ceottaki

Description

@ceottaki

OS?

Any Windows, running from VS2015 NPM Task Runner or through one of the project.json scripts

Versions.

@angular/cli: 1.0.0-beta.32.3
node: 6.9.5
os: win32 x64

Repro steps.

  • Set up an app with ng new
  • Add the app to an ASP.NET Core project in VS2015 with outputs set to wwwroot
  • Attempt to run one of the npm scripts using the NPM Task Runner, such as test, which results in the log below

The log given by the failure.

`

ng test
internal/process/stdio.js:82
throw new Error('Implement me. Unknown stdin file type!');
^
Error: Implement me. Unknown stdin file type!
at process.getStdin [as stdin] (internal/process/stdio.js:82:15)
at D:\DEV\PoC\Ang2App\src\Ang2App\node_modules@angular\cli\bin\ng:149:27
at D:\DEV\PoC\Ang2App\src\Ang2App\node_modules\resolve\lib\async.js:45:21
at ondir (D:\DEV\PoC\Ang2App\src\Ang2App\node_modules\resolve\lib\async.js:188:31)
at D:\DEV\PoC\Ang2App\src\Ang2App\node_modules\resolve\lib\async.js:154:39
at onex (D:\DEV\PoC\Ang2App\src\Ang2App\node_modules\resolve\lib\async.js:94:22)
at D:\DEV\PoC\Ang2App\src\Ang2App\node_modules\resolve\lib\async.js:25:18
at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\f_ceotto\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "run" "test" "--color=always"
npm ERR! node v6.9.5
npm ERR! npm v4.3.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: ng test
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script 'ng test'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ang2-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ng test
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ang2-app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls ang2-app
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\f_ceotto\AppData\Roaming\npm-cache_logs\2017-02-21T12_04_28_453Z-debug.log

Process terminated with code 1.
`

Mention any other details that might be useful.

This is a common issue with a few packages that use process.stdin when running in Windows. A common solution is to replace the process.stdin with an event emitter when running in a headless environment in Windows and I can submit a pull request that addresses the issue like that, but I've also attached a patch with the same:

fix_win32_process_stdin.patch.txt

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