algolia/atom-autocomplete-module-import

'npm' could not be spawned.

Opened this issue · 17 comments

Hi guys, im trying to Install & add to 'dependencies' a node package. but i got this error.
image
I have my npm and node programs installed and settend in the system enviorments (using windows10). I would like to know how to fix this or if this is an issue. Thanks.

Hi @diegodebonis, thanks for reporting that!

We need to work on compatibility with Windows :/

Please bear with us!

Hey @rayrutjes thanks for the quick answer, i would like to say also that in linux works properly. The issue seems to be in Windows.
Regards!

Yes, we do not support Windows currently.
I need to take a look at the way we spawn npm or yarn there.

@diegodebonis do you have npm or yarn installed on your machine?

npm 5.3.0

I've got no windows machine to test the plugin.
Here is the actual line that might need to be adjusted in windows https://github.com/algolia/atom-autocomplete-module-import/blob/master/lib/project.js#L39

Is npm installed globally on your machine? Can you run npm from anywhere?

Yes i can run npm anywhere. I've setted up the env variables.

Can you run the following to see what it outputs?

$ where npm
$ process.env.PATH

I think I'm gonna need the help of a Windows Guru here :/

I'm at work right now (i live in Argentina), but as soon as i arrive to my place i will run those commands.

Thanks a lot @diegodebonis , no rush ;)

Sorry for the delay, here the outputs
image

What @rayrutjes meant with the second part was

$ node -e "console.log(process.env.PATH)"

We need to make the path to the executable configurable.

Sorry for the delay, here the screenshot.

image

Regards!

vvo commented

https://github.com/npm/node-which should solve this I think

So i have to install node-which globally?

vvo commented

So i have to install node-which globally?

No but instead of blindy trying to launch "yarn" or "npm" here:

runCommand(name, args) {
return new Promise((resolve, reject) => {
const process = spawn(name, args, { cwd: this.path });

You could use node-which to get the actual path of the program on any platform (and get an error when not found). That should solve it.

Are you open to trying it?