Comments (18)
What did you get? What did you expect? Operating system? Etc.
from shell-path.
I'm trying to execute the shell script brew install taglib
(using child_process.exec
), but I get the error that the brew
command cannot be found. Similarly, using exec
to run gem list
doesn't return the gems I have installed in my rvm-managed version of ruby.
My full path should look like:
/Users/ericbiewener/.rvm/gems/ruby-2.3.0/bin:/Users/ericbiewener/.rvm/gems/ruby-2.3.0@global/bin:/Users/ericbiewener/.rvm/rubies/ruby-2.3.0/bin:/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin:/Users/ericbiewener/Repos/venv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/ericbiewener/.rvm/bin
When logging the results of shellPath.sync()
from main.js
, I get the following:
/usr/bin:/bin:/usr/sbin:/sbin:/Users/ericbiewener/.rvm/bin
When logging the results of shellPath.sync()
in the client-side JS, I simply get undefined.
I'm on OS X 10.11.4
from shell-path.
And in case it helps, when running as a non-packaged app, I get the following output to my console when running shellPath.sync()
(this occurs even if I don't try logging anything, but just call that method):
bash: no job control in this shell
exit
from shell-path.
Hmm, weird. You're using Bash, right?
from shell-path.
Yes. I came across this module today and am experiencing the same issue:
https://github.com/steelbrain/consistent-path
On Tuesday, May 10, 2016, Sindre Sorhus [email protected] wrote:
Hmm, weird. You're using Bash, right?
—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#11 (comment)
from shell-path.
Can you try running the following code in the packaged app and share the output:
require('child_process').execFileSync('/bin/bash', ['--version'], {encoding: 'utf8'})
require('child_process').execFileSync('/bin/bash', ['-ic', 'env'], {encoding: 'utf8'})
require('child_process').execFileSync('/bin/bash', ['-ic', 'echo $PATH'], {encoding: 'utf8'})
from shell-path.
Also might help to know where these paths are defined in your dotfiles.
from shell-path.
The output of those three, in order:
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)
Copyright (C) 2007 Free Software Foundation, Inc.
(I removed a few items here that didn't seem relevant and that had the word "private" in them)
SHELL=/bin/bash
TMPDIR=/var/folders/cq/bg8lr0dn3v91kzxnhgk8jf640000gn/T/
USER=ericbiewener
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/Users/ericbiewener/.rvm/bin
PWD=/
XPC_FLAGS=0x0
XPC_SERVICE_NAME=com.electron.bowie.194592
SHLVL=1
HOME=/Users/ericbiewener
LOGNAME=ericbiewener
_=/usr/bin/env
/usr/bin:/bin:/usr/sbin:/sbin:/Users/ericbiewener/.rvm/bin
In regards to where the desired paths are defined in my dotfiles:
.bash_profile
- /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin
- /Users/ericbiewener/Repos/venv/bin
.bash_rc
- /Users/ericbiewener/.rvm/bin
Not sure where the ...rvm/gems...
paths are defined, but I could probably figure that out from the RVM website if necessary.
from shell-path.
Not sure if it helps, but I get the same result even if I try running a bash file via execFile
and include the shebang #!/usr/bin/env bash
at the top. I had hoped that this would cause the correct environment to get pulled in, but no dice.
from shell-path.
I was tipped about path_helper
today. Seems like it handles more cases.
@ericbiewener Mind running this in a packaged app?
require('child_process').execFileSync('/usr/libexec/path_helper', {encoding: 'utf8'})
from shell-path.
// @adam-moss ⬆️ Can you too?
from shell-path.
@sindresorhus console.log(require('child_process').execFileSync('/usr/libexec/path_helper', {encoding: 'utf8'}));
in Atom gives me:
VM2003:2 PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/adam.moss/GitHub/ansible/bin:/Users/adam.moss/.nvm/versions/node/v6.2.2/bin"; export PATH;
MANPATH="/usr/share/man:/usr/local/share/man:/Users/adam.moss/GitHub/ansible/docs/man:/Users/adam.moss/.nvm/versions/node/v6.2.2/share/man:/Library/Developer/CommandLineTools/usr/share/man"; export MANPATH;
undefined
echo $PATH
for comparison:
/Users/adam.moss/GitHub/ansible/bin:/Users/adam.moss/.nvm/versions/node/v6.2.2/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Regards
from shell-path.
@sindresorhus It gave me:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"; export PATH;
from shell-path.
Thanks @adam-moss. So it seems path_helper
would at least solve #6.
from shell-path.
@ericbiewener Hmm, still no dice. Maybe we can just hard-code some paths in https://github.com/sindresorhus/fix-path
from shell-path.
path_helper
is used in /etc/profile
, which in turn should be sourced by all shells. I'd not be opposed to us enriching our paths array with paths from path_helper
.
from shell-path.
I updated shell-env (sindresorhus/shell-env@c704d61) to use -l
to obtain a login shell, which in turn should lead to /etc/profile
being sourced. @ericbiewener can you verify if this is fixed by reinstalling the module?
from shell-path.
I'll close this off as I'm pretty certain above update has fixed this issue.
from shell-path.
Related Issues (13)
- just return the %PATH% on windows HOT 3
- Node 0.10 support for `.sync` method HOT 2
- Force interactive shell for common shells HOT 8
- doesn't seem to work on my computer for some weird reason HOT 18
- sync method doesn't work in Electron Renderer HOT 1
- /usr/local/bin not included in returned path HOT 9
- latest techniques still not working in electron sadly HOT 4
- Problem when shell startup prints a string HOT 4
- Remove `sudo` check HOT 4
- TypeError: Cannot read property 'length' of null HOT 28
- Getting error on module.exports = () => shellEnv().then(x => x.PATH) HOT 1
- SyntaxError: Cannot use import statement outside a module HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shell-path.