确定当我运行: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