danielbayley / atom-modular-snippets

:atom: A modular solution to snippets in @Atom.
https://atom.io/packages/modular-snippets
MIT License
9 stars 4 forks source link

Fails when running the preinstall script #1

Closed thibmaek closed 8 years ago

thibmaek commented 8 years ago
 → apm install modular-snippets
Installing modular-snippets to /Users/thibaultmaekelbergh/.atom/packages ✗

> modular-snippets@0.1.0 preinstall /private/var/folders/sl/n559hh3n59316hvw2r8_zjtr0000gn/T/apm-install-dir-11661-26231-1nn9h6g/node_modules/modular-snippets
> cd "${ATOM_HOME:-~/.atom}" && mkdir -p snippets

sh: line 0: cd: ~/.atom: No such file or directory
npm ERR! Darwin 15.5.0
npm ERR! argv "/Applications/Atom.app/Contents/Resources/app/apm/bin/node" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/npm/bin/npm-cli.js" "--globalconfig" "/Users/thibaultmaekelbergh/.atom/.apm/.apmrc" "--userconfig" "/Users/thibaultmaekelbergh/.atom/.apmrc" "install" "/private/var/folders/sl/n559hh3n59316hvw2r8_zjtr0000gn/T/d-11661-26231-19h22rd/package.tgz" "--target=0.36.8" "--arch=x64"
npm ERR! node v0.10.40
npm ERR! npm  v2.13.3
npm ERR! code ELIFECYCLE

npm ERR! modular-snippets@0.1.0 preinstall: `cd "${ATOM_HOME:-~/.atom}" && mkdir -p snippets`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the modular-snippets@0.1.0 preinstall script 'cd "${ATOM_HOME:-~/.atom}" && mkdir -p snippets'.
npm ERR! This is most likely a problem with the modular-snippets package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     cd "${ATOM_HOME:-~/.atom}" && mkdir -p snippets
npm ERR! You can get their info via:
npm ERR!     npm owner ls modular-snippets
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /private/var/folders/sl/n559hh3n59316hvw2r8_zjtr0000gn/T/apm-install-dir-11661-26231-1nn9h6g/npm-debug.log

However, cd ~/.atom works. Also works when exporting an env to the shell first with export ATOM_HOME=~/.atom

danielbayley commented 8 years ago

@thibmaek That's odd 😕 Are you on Windows? Can you run cd "${ATOM_HOME:-~/.atom}" && mkdir -p snippets directly on the command line without error?

thibmaek commented 8 years ago

Nope, on OS X. Running that command without the mkdir outputs:

 → cd "${ATOM_HOME:-~/.atom}"
-bash: cd: ~/.atom: No such file or directory

Your issue is most likely due to wrapping it in quotes. Running without the quotes work just fine, let me PR this to fix it.

danielbayley commented 8 years ago

Ah of course; the tilde ~ won't be expanded inside quotes. There should be a :facepalm: emoji…

The quotes are necessary though in case of spaces in the file path, for example I have ATOM_HOME set to ~/Library/Application Support/Atom.

So the solution is mkdir -p "${ATOM_HOME:-$HOME/.atom}/snippets".

danielbayley commented 8 years ago

@thibmaek Looks like I beat you to it 😄. Cheers though… should work now?

Bogdan808 commented 6 years ago

This problem is basically not solved. Sorry, waiting for the updates for Windows

Bogdan808 commented 6 years ago

I guess that is not generated "ATOM_HOME"

thibmaek commented 6 years ago

It's about 50% solved since it won't support Windows, but should work for everything else. Shouldn't be too hard finding the equivalent command for mkdir for Windows and submitting a PR though. Problem is that that $ATOM_HOME env var is not available on the Windows shell, since it's a UNIX bash one (I think)

Bogdan808 commented 6 years ago

@thibmaek , Thanks for the feedback. To me very important file organization of the snippets. Had to go back to sublimeText. Sadness. :(