shell - zsh script command not finding ruby gem - Stack Overflow

I'm trying to write a simple .zsh script to start my webservers upon computer boot.This works wel

I'm trying to write a simple .zsh script to start my webservers upon computer boot.

This works well:

#!/bin/zsh
cd /Users/me/Sites/Vue/mysite && npm run dev &

But this doesn't work:

#!/bin/zsh
cd /Users/me/Sites/Ruby/mysite && rackup &

This is the error message:

❯ ./myscript.zsh
Resolving dependencies...
Could not find proper version of rack (2.2.4) in any of the sources
Run `bundle install` to install missing gems.

Obviously, when I run the command in the terminal window directly, it cds and executes rackup without a problem.

I'm trying to write a simple .zsh script to start my webservers upon computer boot.

This works well:

#!/bin/zsh
cd /Users/me/Sites/Vue/mysite && npm run dev &

But this doesn't work:

#!/bin/zsh
cd /Users/me/Sites/Ruby/mysite && rackup &

This is the error message:

❯ ./myscript.zsh
Resolving dependencies...
Could not find proper version of rack (2.2.4) in any of the sources
Run `bundle install` to install missing gems.

Obviously, when I run the command in the terminal window directly, it cds and executes rackup without a problem.

Share Improve this question asked Mar 15 at 13:20 thiebothiebo 1,4472 gold badges23 silver badges44 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

It seems that either the rackup executable that is in your $PATH when you open a new terminal is not the same one that's in your path when you run your boot script, or else there are other aspects of the environment that are different in the two different scenarios.

You can test this by adding echo $PATH and env at the top of script and examining what is printed for each scenario.

If using the wrong $PATH is the issue, one quick and easy solution would be to call rackup using the full path instead, like so :

# replace /path/to with actual path

cd /Users/me/Sites/Ruby/mysite && /path/to/rackup &

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744613637a4583916.html

相关推荐

  • shell - zsh script command not finding ruby gem - Stack Overflow

    I'm trying to write a simple .zsh script to start my webservers upon computer boot.This works wel

    2天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信
['keyword'] : $thread['subject']; $header['description'] = $thread['description'] ? $thread['description'] : $thread['brief']; $_SESSION['fid'] = $fid; if ($ajax) { empty($conf['api_on']) and message(0, lang('closed')); $apilist['header'] = $header; $apilist['extra'] = $extra; $apilist['access'] = $access; $apilist['thread'] = well_thread_safe_info($thread); $apilist['thread_data'] = $data; $apilist['forum'] = $forum; $apilist['imagelist'] = $imagelist; $apilist['filelist'] = $thread['filelist']; $apilist['threadlist'] = $threadlist; message(0, $apilist); } else { include _include(theme_load('single_page', $fid)); } break; default: message(-1, lang('data_malformation')); break; } ?>