Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

apm does not (appear) to have the same node version as atom #328

Open
Arcath opened this issue Mar 26, 2015 · 12 comments
Open

apm does not (appear) to have the same node version as atom #328

Arcath opened this issue Mar 26, 2015 · 12 comments

Comments

@Arcath
Copy link

Arcath commented Mar 26, 2015

When installing node-sass it compiles a binding for your os/node version which it then calls later when you require it.

When install via apm install it creates (on my machine) win32-ia32-node-0.10 which is rightly not my system node version. If i then try to require node-sass in my package I get the error that no binding is available and I should re-install node-sass.

Looking at the process.sassBinaryName in Atom it is looking for win32-ia32-atom-1.0

Should apm not be using an identical environment to Atom so that any module that compiles anything will work when required in Atom?

@Arcath Arcath changed the title apm does not (appear) have the same node version as atom apm does not (appear) to have the same node version as atom Mar 26, 2015
@kevinsawicki
Copy link
Contributor

Should apm not be using an identical environment to Atom so that any module that compiles anything will work when required in Atom?

apm compiles all native modules against the v8 headers that ship with Atom.

What error are you getting when node-sass is required?

@Arcath
Copy link
Author

Arcath commented Mar 26, 2015

The error is

libsass bindings not found. Try reinstalling node-sass

@Arcath
Copy link
Author

Arcath commented Apr 16, 2015

Doing some more testing with the node-sass 3.0.0 beta which uses {platform}-{arch}-{modules version} to name its libsass binding. Installed by apm on my machine that results in win32-ia32-11 but run the same function in atom and I get win32-ia32-43.

running process.versions in atom:

modules: '43'
node: '1.5.1'
...
v8: '4.1.0.21'

run the command C:\path\to\atom\app-0.192.0\resources\app\apm\bin\node -e 'console.log(process.versions);'

http_parser: '1.0',
node: '0.10.35',
v8: '3.14.5.9',
ares: '1.9.0-DEV',
uv: '0.10.30',
zlib: '1.2.8',
modules: '11',
openssl: '1.0.1j'

which returns a vastly different answer and using that information would give the binding I get during install.

@kentonv
Copy link

kentonv commented Feb 16, 2016

apm compiles all native modules against the v8 headers that ship with Atom.

Sure, but many npm modules include build scripts that do things like try to stamp the library with the node or v8 version to detect ABI version skew. Those scripts make the reasonable assumption that they are building for the version of node which is executing the script. But under apm, these scripts are run using node 0.10, so they get confused and use that version for the stamp, even if they are actually building against newer headers.

$ /usr/share/atom/resources/app/apm/bin/node --version
v0.10.40

Why is Atom shipping this old node binary when Atom proper is running on something much newer?

@50Wliu
Copy link
Contributor

50Wliu commented Feb 16, 2016

@kentonv There have been attempts in the past to upgrade apm to something newer, but I believe they all ran into some difficulties (one particular one that I'm aware of is that all commands fail on 0.12+).

@Dhq
Copy link

Dhq commented Apr 18, 2016

I just ran in to this same problem, also with node-sass. Did you ever find a solution @Arcath, or was it just concluded that node-sass, atom and windows just won't work at the moment?

@Arcath
Copy link
Author

Arcath commented Apr 19, 2016

@Dhq I ended up using node-sass in a child process which isn't ideal but it works for now.

@50Wliu
Copy link
Contributor

50Wliu commented Aug 25, 2016

apm and Atom are now on similar enough Node versions that I think this can be closed.

@50Wliu 50Wliu closed this as completed Aug 25, 2016
@Dhq
Copy link

Dhq commented Sep 2, 2016

@50Wliu Well, in the case of node-sass at least it still doesn't work. On my windows machine, apm installs bindings in node-sass for win32 with node 4.x, while inside Atom it seems to be looking for a win32 on node 5.X.

Missing binding C:\XXX\node_modules\node-sass\vendor\win32-ia32-47\binding.node
Node Sass could not find a binding for your current environment: Windows 32-bit with Node.js 5.x
Found bindings for the following environments:
  - Windows 32-bit with Node.js 4.x
This usually happens because your environment has changed since running npm install.
Run `npm rebuild node-sass` to build the binding for your current environment.

@50Wliu
Copy link
Contributor

50Wliu commented Sep 2, 2016

Atom is using Node 4: https://github.com/atom/atom/blob/master/appveyor.yml#L15

@Dhq
Copy link

Dhq commented Sep 2, 2016

@50Wliu Ok, thanks.

Can't understand why it's looking for node 5.X for me then. My global node locally is 6.0.0... Will try to find it out :)

@50Wliu
Copy link
Contributor

50Wliu commented Sep 3, 2016

@Dhq After doing some investigation, I've come to the conclusion that my above comment was wrong. Sorry about that.

What appears to be happening is that while Atom is built using Node 4 on Appveyor, it still inherits Electron's Node version. We currently use Electron 0.37.8, which uses Node 5.10.0.

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

No branches or pull requests

5 participants