简体   繁体   中英

Add express to Path in NodeJS

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?

您需要将该行添加到将在登录时获取的文件中,例如: ~/.bash_profile

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM