0

I installed modernizr: npm install -g modernizr Everything went well without errors: /Users/myusername/npm/bin/modernizr -> /Users/myusername/npm/lib/node_modules/modernizr/bin/modernizr /Users/myusername/npm/lib

After install running: modernizr I get:

zsh: command not found: modernizr

In my .zshrc file I have:

export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

After googling around find this post: Bower: "command not found" after installation and added this line to my .zshrc file: export PATH=/usr/local/share/npm/bin:$PATH

When I type which npm I get /usr/local/bin/npm

But I'm still getting command not found. I checked files with Mac Finder and found modernizer in myusername/npm/node_modules/modernizer - this should be right? How to fix zsh command not found?

Community
  • 1
  • 1
ace
  • 283
  • 1
  • 16
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww May 09 '18 at 04:03

2 Answers2

2

Change PATH export to

export PATH=$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$HOME/npm/bin

You can also remove the double quotes.

kometen
  • 6,536
  • 6
  • 41
  • 51
  • I did change export PATH but still getting `command not found` – ace Jan 08 '16 at 09:03
  • Can you paste the output from 'ls -l $HOME/npm/node_modules/modernizer'? Maybe it needs to have executable settings. – kometen Jan 08 '16 at 09:07
  • It says `ls: /Users/myusername/npm/node_modules/modernizer: No such file or directory`. Oh, actually my right bath is `/Users/myusername/npm/lib/node_modules/modernizer` – ace Jan 08 '16 at 09:08
  • Aah, try 'ls -l $HOME/npm/bin'. Can you find the file modernizr? I changed the path setting above. Does your path include $HOME/npm/bin? – kometen Jan 08 '16 at 09:14
0

For WSL2 + NVM user:

  1. Add following to the end of ~/.zshrc

***ignore last line if bash_completion not installed

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" #npm package
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" #loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" #loads nvm bash_completion
  1. Restart terminal
Malcolm T
  • 41
  • 6