linux下安装nodejs出现 npm-cli.js: No such file or director 的真正解决方案

linux下安装nodejs,新手上路避坑

按照网上百度到的其他去安装nodejs报错

../lib/node_modules/npm/bin/npm-cli.js: No such file or directory

然后继续百度 说是软连接问题,修改后继续报错

Usage: npm <command>

where <command> 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 <command> -h  quick help on <command>
npm -l            display full usage info
npm help <term>   search for help on <term>
npm help npm      involved overview

Specify configs in the ini-formatted file:
    /root/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

npm@6.4.1 /app/nodejs/lib/node_modules/npm

面向百度编程,各种深坑不多叙述,终于找到一个有用的文章

最后发现是因为安装包的问题,没有在linux下解压,导致npm和node 多了 38字节

最后在linux 下安装并配置好环境就成功了

tar -xJvf node-v10.16.3-linux-x64.tar.xz
vim /etc/profile
export NODE_HOME=/usr/local/node-v10.15.3-linux-x64
export PATH=$PATH:$NODE_HOME/bin

最后不要忘记
**输入 source /etc/profile 使设置生效

 node -v
v12.16.1

 npm -v
6.13.4

成功,感谢文章原作者

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值