CommandTaskRunner icon indicating copy to clipboard operation
CommandTaskRunner copied to clipboard

AngularJS 2 CLI - "ng serve" stdin error

Open STNME opened this issue 9 years ago • 3 comments

Installed product versions

  • Visual Studio: 2015 Professional
  • This extension: 1.2.32

Description

AngularJS 2 ng commands are throwing an error regarding stdin.

Steps to recreate

  1. Install VS NodeJS project plugin from https://visualstudiogallery.msdn.microsoft.com/68faf8ac-b953-42f5-a908-55555deccf7a
  2. Create a new NodeJS project
  3. Add a commands.json file. "FileName": "cmd.exe", Arguments": "/c npm start". This calls "ng serve" which is the AngularJS 2 CLI command that starts WebPack.

Current behavior

Here is the output:

ng serve 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 at C:...\node_modules\angular-cli\bin\ng:38:27 at C:...\node_modules\resolve\lib\async.js:44:21 at ondir (C:...\node_modules\resolve\lib\async.js:187:31) at C:...\node_modules\resolve\lib\async.js:153:39 at onex (C:...\node_modules\resolve\lib\async.js:93:22) at C:...\node_modules\resolve\lib\async.js:24:18 at FSReqWrap.oncomplete (fs.js:123:15) npm ERR! Windows_NT 6.1.7601 Process terminated with code 1. npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start" npm ERR! node v6.9.1 npm ERR! npm v3.10.8 npm ERR! code ELIFECYCLE npm ERR! [email protected] start: ng serve npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] start script 'ng serve'. 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 web-ui package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! ng serve npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs web-ui npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls web-ui npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! C:...\npm-debug.log

Expected behavior

The ng serve command works OK from a manual CMD prompt, and it would be very handy if it worked from VS. BTW I get the same error with the NPM Task Runner.

STNME avatar Oct 28 '16 13:10 STNME

It's probably due to VS using a 32 bit version of node.exe by default in VS 2015. Try to use your own version of node, but moving the PATH up like explained here https://blogs.msdn.microsoft.com/webdev/2015/03/19/customize-external-web-tools-in-visual-studio-2015/

madskristensen avatar Oct 28 '16 14:10 madskristensen

I appreciate the fast response. I had already made that adjustment, and the error output verifies that freshly-installed Node v6.9.1 is being used. Is the Angular 2 CLI expecting Standard In and it's not defined for some reason? From a command prompt, I can type in "start npm start", and that opens a new command prompt and runs the npm command OK.

STNME avatar Oct 28 '16 15:10 STNME

I found this while trying to solve the same issue myself, and I've just submitted a pull request to the angular-cli project to address it: https://github.com/angular/angular-cli/pull/4871

ceottaki avatar Feb 21 '17 12:02 ceottaki