Cannot spawn process: npm start

Andre Pany via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Oct 4 05:58:19 PDT 2016


Hi,

I need to call a Node application. node and npm are in windows 
path variable.
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. I always 
receive an error "Failed to spawn new process". As I specify the 
work directory, this should work, or?

Kind regards
André




More information about the Digitalmars-d-learn mailing list