Node postinstall fails, can't find .atom/.node-gyp/init.bat


#1

Most of my package installs with Atom have been fine. However, some installs (such as beautify and build) fail every time, always with the same error:
`

spawn-sync@1.0.15 postinstall C:\Users\Mathew\AppData\Local\Temp\apm-install-dir-116018-264-1hazun4\node_modules\atom-beautify\node_modules\cross-spawn\node_modules\spawn-sync
node postinstall
Installing native dependencies (this may take up to a minute)
‘C:\Users\Mathew.atom.node-gyp\init.bat’ is not recognized as an internal or external command,
operable program or batch file.
npm ERR! Windows_NT 6.2.9200
npm ERR! argv “C:\Users\Mathew\AppData\Local\atom\app-1.4.0\resources\app\apm\bin\node.exe” “C:\Users\Mathew\AppData\Local\atom\app-1.4.0\resources\app\apm\node_modules\npm\bin\npm-cli.js” “–globalconfig” “C:\Users\Mathew\.atom\.apm\.apmrc” “–userconfig” “C:\Users\Mathew\.atom\.apmrc” “install” “C:\Users\Mathew\AppData\Local\Temp\d-116018-264-9d2b0p\package.tgz” “–target=0.34.5” “–arch=ia32” "–msvs_version=2015"
npm ERR! node v0.10.40
npm ERR! npm v2.13.3
npm ERR! code ELIFECYCLE
npm ERR! spawn-sync@1.0.15 postinstall: node postinstall
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the spawn-sync@1.0.15 postinstall script ‘node postinstall’.
npm ERR! This is most likely a problem with the spawn-sync package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node postinstall
npm ERR! You can get their info via:
npm ERR! npm owner ls spawn-sync
npm ERR! There is likely additional logging output above.

How can I fix this problem? I have already reinstalled atom, and the problems persists even without any other packages or settings.


#2

node-gyp, to my understanding, is what is used to compile native dependencies for Node modules. Some Atom packages have native dependencies and what this means is that you have to have compiler tools installed for these installs to work. What that means is that you have to install the tools listed under “Requirements” here:


#3

I have tried installing everything, restarting, no change. I have tried building atom as well, hoping that it could maybe fix the issue. Interestingly, I receive the same error:

C:\atom2>script\build
Node: v5.4.1
npm: v2.13.3
Python: v2.7.0
Installing build modules...
=> Took 16262ms.

Installing apm...
=> Took 3457ms.

Deleting old packages...
=> Took 2291ms.

Installing modules failed
> atom@1.6.0-dev preinstall C:\atom2
> node -e 'process.exit(0)'


'C:\Users\Mathew\.atom\.node-gyp\init.bat' is not recognized as an internal or external command,
operable program or batch file.

npm ERR! Windows_NT 6.2.9200    
npm ERR! argv "C:\\atom2\\apm\\node_modules\\atom-package-manager\\bin\\node.exe" "C:\\atom2\\apm\\node_modules\\atom-package-manager\\node_modules\\npm\\bin\\npm-cli.js" "--globalconfig" "C:\\Users\\Mathew\\.atom\\.apm\\.apmrc" "--    userconfig" "C:\\Users\\Mathew\\.atom\\.apmrc" "install" "--target=0.34.5" "--arch=ia32" "--msvs_version=2015"
npm ERR! node v0.10.40
npm ERR! npm  v2.13.3
npm ERR! code ELIFECYCLE
npm ERR! atom@1.6.0-dev preinstall: `node -e 'process.exit(0)'`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the atom@1.6.0-dev preinstall script 'node -e 'process.exit(0)''.
npm ERR! This is most likely a problem with the atom package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node -e 'process.exit(0)'
npm ERR! You can get their info via:
npm ERR!     npm owner ls atom
npm ERR! There is likely additional logging output above.

For the record, my node-gyp version is v3.2.1.


#4

I’m not sure which versions of Node the Atom build process is compatible with. I’m still using v0.12.7 to build Atom. It may be that you’re using too new of a version of Node?