简体   繁体   中英

Installing nodeJs in ubuntu

Hi I am trying to install nodejs in ubuntu 14 but getting following error.

E: Cannot get debconf version. Is debconf installed?
    debconf: apt-extracttemplates failed: No such file or directory
    Extracting templates from packages: 62%E: Cannot get debconf version. Is debconf installed?
    debconf: apt-extracttemplates failed: No such file or directory
    Extracting templates from packages: 100%
    dpkg: cannot scan updates directory `/var/lib/dpkg/updates/': No such file or directory
 E: Sub-process /usr/bin/dpkg returned an error code (2)

when trying to installing with software updated I am getting following error.

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/aptdaemon/worker.py", line 300, in _process_transaction
    not self.is_dpkg_journal_clean()):
  File "/usr/lib/python3/dist-packages/aptdaemon/worker.py", line 1111, in is_dpkg_journal_clean
    for dentry in os.listdir(status_updates):
FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/dpkg/updates/'

以前我有这个问题,我删除了所有等于零的变量,并解决了这个问题,也许可以尝试一下。

Add the Node.js-maintained repositories to your Ubuntu package source list with this command:

curl -sL https://deb.nodesource.com/setup | sudo bash -

Then install Node.js with apt-get:

sudo apt-get install nodejs

Optionally we can create a symbolic link for node (for reasons mentioned earlier):

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

Using this install option, we end up with newer versions of Node.js and npm:

$ node -v

$ npm -v

to check node version and npm version

I suggest installing nvm (node version manager) https://github.com/creationix/nvm

it allows you to install and use ANY node version, and this may be way better, because ubuntu is bound to one specific version. In web development, every project is prepared using dofferen node, so switching it might be necessary

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM