確定當我運行:NPM不承認任何命令
npm install nodemon -g
它返回:
/home/ubuntu/.node/bin/nodemon -> /home/ubuntu/.node/lib/node_modules/nodemon/bin/nodemon.js
[email protected] /home/ubuntu/.node/lib/node_modules/nodemon
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected])
或
npm install forever -g
或任何節點安裝i,那麼不能訪問命令之後:
nodemon: command not found
,但如果我直接引用文件是永遠的情況下,我可以運行它們:
/home/ubuntu/.node/lib/node_modules/forever/bin/forever server/app.js &
作品就好了.... 爲什麼呢? 修復?
資料...
GNU nano 2.2.6 File: /home/ubuntu/.profile
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
export PATH = /home/ubuntu/.node/bin:$PATH
fi
命令! :
echo $PATH:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
而且
ls -la
drwxrwxr-x 2 ubuntu ubuntu 4096 Dec 6 14:42 .
drwxrwxr-x 4 ubuntu ubuntu 4096 Dec 6 12:24 ..
lrwxrwxrwx 1 ubuntu ubuntu 39 Dec 6 14:42 forever -> ../lib/node_modules/forever/bin/forever
lrwxrwxrwx 1 ubuntu ubuntu 42 Dec 6 14:19 nodemon -> ../lib/node_modules/nodemon/bin/nodemon.js
奇怪,現在給我這個上rersart:
-bash: export: `=': not a valid identifier
-bash: export: `/home/ubuntu/.node/bin:/home/ubuntu/.node/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games': not a valid identifier
顯然,npm安裝二進制文件的路徑不在你的PATH中。 – poke 2014-12-06 14:31:09
是的,我一直在閱讀,我需要編輯bashrc什麼的,但有點不確定如何去做。 – vimes1984 2014-12-06 14:34:37