逛了一圈网上,根据他们写的教程走了一遍,安装下来会发现,npm -v都会提示
Usage: npm
where is one of:
access, adduser, audit, bin, bugs, c, cache, ci, cit,
completion, config, create, ddp, dedupe, deprecate,
dist-tag, docs, doctor, edit, explore, get, help,
help-search, hook, i, init, install, install-test, it, link,
list, ln, login, logout, ls, outdated, owner, pack, ping,
prefix, profile, prune, publish, rb, rebuild, repo, restart,
root, run, run-script, s, se, search, set, shrinkwrap, star,
stars, start, stop, t, team, test, token, tst, un,
uninstall, unpublish, unstar, up, update, v, version, view,
whoami
npm -h quick help on
npm -l display full usage info
npm help search for help on
npm help npm involved overview
Specify configs in the ini-formatted file:
/root/.npmrc
or on the command line via: npm --key value
Config info can be viewed via: npm help config
搞不清为什么,最后终于找到一个方法可以安装nodejs,我是在centos7下,希望能帮到大家
删除之前安装的nodejs,然后在su权限下敲入
curl -sL https://rpm.nodesource.com/setup_5.x | bash -
sudo yum install -y nodejs
此时,node和npm还没加入环境
找到nodejs下node和npm命令
find / -name node
#或者
whereis node
假设这是node地址,建立软链接
ln -s /usr/bin/node
ln -s /usr/bin/npm
完成,查看版本
node -v
npm -v