[Issue 16591] New: Spawn process on windows fails for npm start

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Oct 4 10:01:47 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16591

          Issue ID: 16591
           Summary: Spawn process on windows fails for npm start
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: andre at s-e-a-p.de

Following example is working fine on linux but on windows spawn process fails
with an exception. 

I have following folder structure:
./app.d
./js/helloworld.js
./js/package.json

content of helloworld.js:
console.log('hello world');

content of package.json:
{
  "name": "test",
  "version": "1.0.0",
  "scripts": {
    "start": "node helloworld.js"
  }
}

content of app.d
import std.process, std.path, std.file, std.stdio;

void main()
{
  string workDir = buildPath(thisExePath.dirName, "js");
  string[] args = ["npm", "start"];
  spawnProcess(args, std.stdio.stdin, std.stdio.stdout, std.stdio.stderr, null,
std.process.Config.none, workDir);
}

I compile with dmd and then start the application.
On windows spawn process is not able to execute > npm start.
On Ubuntu Linux the application works fine.

To install node on ubuntu:
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs

For windows there is setup routine available on nodejs.org

--


More information about the Digitalmars-d-bugs mailing list