Cannot install NodeJs: /usr/bin/env: node: No such file or directory

后端 未结 18 1117
野趣味
野趣味 2020-11-28 00:01

I\'m trying to install nodeJs into my Ubuntu 14.04 in order to use GruntJs.

I\'ve read about Ubuntu different way of doing it (issues?), so this is what I\'ve done i

相关标签:
18条回答
  • 2020-11-28 00:34

    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
    
    0 讨论(0)
  • 2020-11-28 00:34

    Just rename the command or file name ln -s /usr/bin/nodejs /usr/bin/node by this command

    0 讨论(0)
  • 2020-11-28 00:35
    sudo PATH="$PATH:/usr/local/bin" npm install -g <package-name>
    
    0 讨论(0)
  • 2020-11-28 00:36

    I think you should upgrade lastest node version

    sudo npm cache clean -f
    sudo npm install -g n
    sudo n stable
    
    0 讨论(0)
  • 2020-11-28 00:39

    The issue is not with the version of node. Instead, it is the way NodeJS is installed by default in Ubuntu. When running a Node application in Ubuntu you have to run nodejs somethign.js instead of node something.js

    So the application name called in the terminal is nodejs and not node. This is why there is a need for a symlink to simply forward all the commands received as node to nodejs.

    sudo ln -s /usr/bin/nodejs /usr/bin/node
    
    0 讨论(0)
  • 2020-11-28 00:39

    if you are able to access node on ubuntu terminal using nodejs command,then this problem can be simply solved using -creating a symbolic link of nodejs and node using

    ln -s /usr/bin/nodejs /usr/bin/node

    and this may solve the problem

    0 讨论(0)
提交回复
热议问题