I set up an NPM_TOKEN in my .zshrc file. When I run yarn start in a terminal my Gatsby app runs fine, but when I create an NPM run configuration in WebStorm for start, it can't find the token:
error An unexpected error occurred: "Failed to replace env in config: ${NPM_TOKEN}".
I actually get the same error when attempting to commit from Webstorm. Works fine in terminal (even the WS terminal)
I have Fig installed, and ohmyzsh, and here is my .zshrc file.
[[ -f "$HOME/.fig/shell/zshrc.pre.zsh" ]] && builtin source
"$HOME/.fig/shell/zshrc.pre.zsh"
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="robbyrussell"
plugins=(git)
source $ZSH/oh-my-zsh.sh
source ~/.zprofile # loads some custom aliases using "source
.aliases/some_alias_file.zsh" etc
export NPM_TOKEN="my token"
[[ -f "$HOME/.fig/shell/zshrc.post.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.post.zsh"
export NVM_DIR="$HOME/.nvm"
Is there a way to fix this?
UPDATE: Adding my NPM_TOKEN to .bashrc fixed this. So I guess Webstorm is running bash, or reading that file, instead of zsh and reading its config files? We're slightly over my head at this point. But I would imagine there's a way to configure this?
Related
jq command not found after adding jq executable
installing jq on git bash
My usecase is more similar with above shared references. I tried to execute a hook that needs to parse a json file. When hook gets executed it throws bash: jq:command not found error. So. I downloaded jq-win64.exe file and copied it to /usr/bin in Git folder. Then from git-bash I run export PATH=$PATH:"/C/Program Files/Git/usr/bin/jq-win64.exe" command and there is no error but when I checked jq --version command it still shows bash: jq:command not found error
Am I missing something? I even tried in windows cmd but is of no use. Hope someone can help me.
Thanks in advance!!!
PATH contains directories. That means what you should do:
Rename jq-win64.exe to jq.exe or just jq. (e.g. cp ~/Downloads/jq-win64.exe /usr/bin/jq).
You don't have to export your path, /usr/bin is already part of it.
If you didn't rename the file to jq (or jq.exe), then you would have to run it as jq-win64 in your console.
You could also put the binary into ~/bin folder, which should be part of PATH too. If it isn't, you can add it. Then you don't need to mess with your global binaries folder.
I am trying to change the ruby version with rbenv, it seems that there is an env variable
RBENV_VERSION=3.0.1
I cannot find where does this comes from, there is no declaration on .zshrc file.
On the .szhenv file I have the following
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
Is there any other file that could define this env variable?
It's most likely the eval "$(rbenv init -)" line. That runs rbenv init - and then runs the output as shell commands.
If that doesn't help, you can add setopt xtrace to the start of your .zshenv. This will dump every command the shell runs to stderr, with file names and line numbers. You can then do zsh -il 2>trace.log and search trace.log for RBENV_VERSION.
From the rbenv github page, it looks like you can use rbenv shell <version> to set the version for a shell session, which sets $RBENV_VERSION.
I was installing RoR the other day and when I opened my iterm2, this was on startup :
This is on my .bash_profile
# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export WORKON_HOME=$HOME/.virtualenv
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenv
alias python='/usr/local/bin/python3'
echo 'export PATH="/usr/local/sbin:$PATH"'
alias q='exit'
echo 'export PATH="/usr/local/sbin:$PATH"'
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export GEM_HOME=~/.ruby
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
export PATH=/Users/highcenoid/gems/bin:/usr/local/opt/sqlite/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
On my .zshrc :
export PATH=$HOME/bin:/usr/local/bin:$PATH
export ZSH="/Users/user/.oh-my-zsh"
ZSH_THEME="powerlevel9k/powerlevel9k"
DISABLE_AUTO_TITLE="true"
ENABLE_CORRECTION="true"
plugins=(git django npm node pip python yarn brew virtualenv)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status virtualenv)
source $ZSH/oh-my-zsh.sh
export MANPATH="/usr/local/man:$MANPATH"
[[ -f /usr/local/lib/node_modules/serverless/node_modules/tabtab/.completions/serverless.zsh ]] && . /usr/local/lib/node_modules/serverless/node_modules/tabtab/.completions/serverless.zsh
[[ -f /usr/local/lib/node_modules/serverless/node_modules/tabtab/.completions/sls.zsh ]] && . /usr/local/lib/node_modules/serverless/node_modules/tabtab/.completions/sls.zsh
[[ -f /usr/local/lib/node_modules/serverless/node_modules/tabtab/.completions/slss.zsh ]] && . /usr/local/lib/node_modules/serverless/node_modules/tabtab/.completions/slss.zsh
export DEFAULT_USER="$(whoami)"
export PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH"
export PATH="$PATH:$HOME/.rvm/bin"
This is my virtualenv
#!/usr/bin/python
# EASY-INSTALL-ENTRY-SCRIPT:
'virtualenv==16.4.3','console_scripts','virtualenv'
__requires__ = 'virtualenv==16.4.3'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('virtualenv==16.4.3', 'console_scripts',
'virtualenv')()
)
What else do I need to show?
What is happening?
Your .zshrc looks OK, but problem is with in your .bash_profile. Shell config files are just shell scripts executed when shell starts. And in this line of .bash_profile
source /usr/local/bin/virtualenv
content of virtualenv file is included into shell script (source is like include or import in other languages). And including any other language source into shell script will always cause errors.
Why?
I don't know how virtualenv should be installed and initiated, but this is obviously wrong. My first guesss would be that virtualenv should be a shell script, but something overwrote it with python content. Or - virtualenvs content is OK, but it should not be initiated by sourcing it into .bash_profile, but executed there.
OK, but how do I fix it?
There is not much to do, if my first guess is right. Maybe reinstalling virtualenv related stuff could help.
But in the second case - change the source line mentioned above to
/usr/local/bin/virtualenv
save the file, and that should do the trick. This tells not to include virtualenv but to execute it.
PS. export PATH=...
Last two lines
export PATH="/usr/local/sbin:$PATH"
export PATH="/usr/local/sbin:$PATH"
show up, because again your .bash_profile says so. There are two lines: 9 and 12
echo 'export PATH="/usr/local/sbin:$PATH"'
echo is like print in other languages. So this tells shell to print some static strings. If you don't like that, you can remove those lines or put # in front of them, to comment them out.
I'm writing a shell script I can run on a new machine to install my apps, set preferences, arrange dock, and add homebrew packages, and I'd like to be able to configure atom packages within the script instead of manually. Is this possible?
Edit: Also I'd like to change the theme from command line, is that possible?
cd ~/.atom
touch init.coffee
echo "atom.config.set('core.themes', ['THEME_HERE', 'SYNTAX_THEME_HERE'])" >> init.coffee
Atom configuration settings are stored as CSON text in config.cson in the .atom directory. So, for example, if you ran
atom.config.set('core.themes', ['THEME_HERE', 'SYNTAX_THEME_HERE'])
from inside Atom, in the config.cson file, you would see:
"*":
core:
themes: [
"THEME_HERE"
"SYNTAX_THEME_HERE"
]
So, you can write directly to this file from your shell script to configure Atom. You can also change config.cson to config.json and use JSON (instead of CSON) to configure the editor, which can make it easier to use things like jq to work with the file.
I have a personal scripts folder: ~/google_drive/code/scripts. This folder is on my $path. $path is set in ~/.zshenv and not changed anywhere else (I've disabled OS X path_helper and I don't touch $path in any other zsh startup file). In this scripts folder, there is a subdirectory called alfred_workflows. From the command line, from any location I am able to run scripts in this folder with relative paths. This is expected:
$ alfred_workflows/test.sh
#=> test successful
But in a script, this does not work. It generates an error:
$ zsh -c "alfred_workflows/test.sh"
#=> zsh:1: no such file or directory: alfred_workflows/test.sh
Once again, the scripts directory that contains alfred_workflows is on $path, which is set in ~/.zshenv, and I am able to run executables that reside in the top level of this directory from a script. The issue only seems to be when I try to go through a subdirectory. What might be the problem?
Searching of the $path is only done for names containing a slash if the
path_dirs option is set. Apparently that's set in your interactive shell,
but isn't set in the process that's executing the script.