【问题标题】:Can't run NPM or ng build, or Apache in Ubuntu terminal [duplicate]无法在 Ubuntu 终端中运行 NPM 或 ng build 或 Apache [重复]
【发布时间】:2018-07-19 00:32:56
【问题描述】:

昨天我试图在 ubuntu 14 上运行一个 .sh 脚本,我得到了这个

/usr/bin/env: ‘bash\r’: No such file or directory

所以我尝试通过运行来修复它

sudo ln -snf /bin/env /usr/bin/env

这让我可以运行 sh 脚本,但它不会破坏所有的 npm 路径,而且我不是 linux 人,所以不确定如何修复它。

对于我得到的 npm 或 ng 命令

-bash: /usr/bin/npm: /usr/bin/env: bad interpreter: No such file or directory

-bash: /usr/local/bin/ng: /usr/bin/env: bad interpreter: No such file or directory

我可以看到错误并且 /user/bin/env 中没有 env 文件

它影响了一切,我什至无法启动 apache2

Failed to restart apaceh2.service: Unit apaceh2.service not found.

应该有什么或者我该如何解决这个问题?彻底迷路了

【问题讨论】:

  • "ubuntu 14" — Ubuntu 版本号采用yy.mm 的形式,其中yy 是两位数的年份,xx 是两位数的发布月份。没有“ubuntu 14”

标签: node.js ubuntu npm


【解决方案1】:
  1. 您应该检查 Node.js 是否正确安装在您的 ubuntu 机器上。

  2. 您应该在安装 Angular cli 之前安装 node-gyp。

    $ sudo npm install -g node-gyp
    $ sudo npm install -g @angular/cli
    

【讨论】:

  • 运行 npm 是它给出的问题 -bash: /usr/bin/npm: /usr/bin/env: bad interpreter: No such file or directory
  • 我不觉得这是重复的,因为前面的问题与 windows 有关。
猜你喜欢
  • 2017-10-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-03-14
  • 2022-01-22
  • 2017-12-25
  • 1970-01-01
相关资源
最近更新 更多