Reputation: 2520
Hi im working on NodeJS with express in Mac OS, After install: with brew: https://changelog.com/posts/install-node-js-with-homebrew-on-os-x
Shows me:
/Users/dortiz/.npm-packages/bin/express -> /Users/dortiz/.npm-packages/lib/node_modules/express-generator/bin/express-cli.js
And if I will execute:
daortiz:~ dortiz$ express -bash: express: command not found
But:
/Users/dortiz/.npm-packages/bin/express
Its working,
Im trying to export a path with
export PATH=$PATH:/Users/dortiz/.npm-packages/bin/
Its success, but if I close and reopen the terminal don't works command
But doesn't works, any one know what I doing wrong?
Upvotes: 0
Views: 635
Reputation: 104
Using export sets environment variables for current shell only. Once shell is terminated environment variables for that shell no longer exist. In order to set environment variables for all shell that are initiated you should put them in ~/.bash_profile as pointed by mailo.
Upvotes: 1
Reputation: 31
You need to add the line to a file that will be sourced on login, for example: ~/.bash_profile
Upvotes: 1