【/usr/bin/env: node: No such file or directory】 的解决办法

今早突然想升级下 npm,在 ubuntu (windows 10 子系统)下,输入了如下的命令:

$ sudo npm install npm -g
/usr/bin/env: ‘node’: No such file or directory

没成功,错误提示:/usr/bin/env: ‘node’: No such file or directory,
解决步骤还是老套路,
第一步,把错误提示拷贝到搜索引擎,找找
找到了 https://github.com/nodejs/node-v0.x-archive/issues/3911
别人遇到的一样的问题

也给出了两个解决方案(任选其一):

I've found this is often a misnaming error, if you install from a package manager you bin may be called nodejs so you just need to symlink it like so ln -s /usr/bin/nodejs /usr/bin/node

Just do
$ sudo apt-get install nodejs-legacy
https://github.com/volojs/volo#install

也有人把原因给发出来了,有兴趣八卦可以读一读,是关于 Debian 社区和 Node 社区之间的事儿:

@houmie (and everyone who comes across this bug in the future)
These explain why:
http://lists.debian.org/debian-devel-announce/2012/07/msg00002.html
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=614907
http://debian.2.n7.nabble.com/Node-js-and-it-s-future-in-debian-td1042211.html (only read this last thread if you're a masochist)
As a Node developer, I would think hard before using Debian's packaged version of node, and would use Ubuntu with chrislea's PPA for Node or Debian stable with Node built from source in preference to the stock Debian nodejs package for the foreseeable future. The discussion on this bug makes clear that Debian has a very different idea of the role of Node in the wider world than most of the Node community.

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,683评论 0 10
  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 10,818评论 0 23
  • 去年夏天种下的这株飘香藤,很快就不负寄托的蹭蹭爬满了半个阳台,开着并不香的红艳艳的花~ 许是营养不良,许是疏于照料...
    echo_lei阅读 277评论 0 1
  • 前面说到了人类的思维从找到事物因果联系的确定性的机械性思维,到发现世界是不确定性的思维模式是巨大的进步。这里我们也...
    叹谁逍遥阅读 174评论 0 0
  • 2018年7月23日 星期一 阴雨 文/随眼前 01 每日精进: 昨天我做得不好的事情是什么?我当时是怎么考虑的?...
    书香剑气巴士阅读 520评论 0 2

友情链接更多精彩内容