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

Windows spawn npm ENOENT #180

Open
galbenyosef opened this issue Oct 23, 2019 · 0 comments
Open

Windows spawn npm ENOENT #180

galbenyosef opened this issue Oct 23, 2019 · 0 comments

Comments

@galbenyosef
Copy link

galbenyosef commented Oct 23, 2019

Hello,
I keep getting this error when trying to open live view on single screen:
Capture2

Capture

explored some around and found this issue:

https://stackoverflow.com/questions/43230346/error-spawn-npm-enoent

Based on best answer of the issue, these are the changes which has to be done

windowSimulator.js Lines 14-25:

if (projInfo.devServerScript === 'start') { const child = spawn('npm', ['start'], {cwd: projInfo.rootPath}); child.stdout.on('data', (data) => { global.mainWindow.webContents.send('start simulator',['http://localhost:3000',child.pid]); }); //Simulation for react-dev-server } else if (projInfo.devServerScript === 'run dev-server') { let child = spawn('npm', ['run', 'reactide-server'], {cwd: projInfo.rootPath}); child.stdout.on('data', (data) => { global.mainWindow.webContents.send('start simulator',['http://localhost:8085', child.pid]); }) }

Became:

if (projInfo.devServerScript === 'start') { const child = spawn('npm.cmd', ['start'], {cwd: projInfo.rootPath}); child.stdout.on('data', (data) => { global.mainWindow.webContents.send('start simulator',['http://localhost:3000',child.pid]); }); //Simulation for react-dev-server } else if (projInfo.devServerScript === 'run dev-server') { let child = spawn('npm.cmd', ['run', 'reactide-server'], {cwd: projInfo.rootPath}); child.stdout.on('data', (data) => { global.mainWindow.webContents.send('start simulator',['http://localhost:8085', child.pid]); }) }

Walla... now it works...

Capture3

Conclusion:

Windows os has to spawn npm.cmd and not npm, which is fine for other os...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant