node.js - how to install npm on ubuntu? -


i want install mocha test framework need npm ran following commands
1. sudo apt-get install npm
2. npm install -g mocha

but getting following error when ran first command

user@dell:~/mochatest$ sudo apt-get install npm [sudo] password user:  reading package lists... done building dependency tree        reading state information... done following packages automatically installed , no longer required:   apt-clone archdetect-deb autogen ax25-node binutils-mingw-w64-i686   binutils-mingw-w64-x86-64 dmraid g++-mingw-w64 g++-mingw-w64-i686   g++-mingw-w64-x86-64 gcc-mingw-w64 gcc-mingw-w64-base gcc-mingw-w64-i686   gcc-mingw-w64-x86-64 gfortran-mingw-w64 gfortran-mingw-w64-i686   gfortran-mingw-w64-x86-64 gir1.2-json-1.0 gir1.2-timezonemap-1.0   gir1.2-xkl-1.0 gnat-mingw-w64 gnat-mingw-w64-base gnat-mingw-w64-i686   gnat-mingw-w64-x86-64 kpartx kpartx-boot libax25 libdebian-installer4   libdevmapper-event1.02.1 libdmraid1.0.0.rc16 libopts25 libopts25-dev lvm2   mingw-w64 mingw-w64-common mingw-w64-i686-dev mingw-w64-x86-64-dev   openbsd-inetd python3-icu python3-pam quilt rdate watershed use 'apt-get autoremove' remove them. following packages installed:   node-abbrev node-ansi node-archy node-async node-block-stream   node-combined-stream node-cookie-jar node-delayed-stream node-forever-agent   node-form-data node-fstream node-fstream-ignore node-github-url-from-git   node-glob node-graceful-fs node-gyp node-inherits node-ini   node-json-stringify-safe node-lockfile node-lru-cache node-mime   node-minimatch node-mkdirp node-mute-stream node-node-uuid node-nopt   node-normalize-package-data node-npmlog node-once node-osenv node-qs   node-read node-read-package-json node-request node-retry node-rimraf   node-semver node-sha node-sigmund node-slide node-tar node-tunnel-agent   node-which nodejs-dev suggested packages:   node-hawk node-aws-sign node-oauth-sign node-http-signature following new packages installed:   node-abbrev node-ansi node-archy node-async node-block-stream   node-combined-stream node-cookie-jar node-delayed-stream node-forever-agent   node-form-data node-fstream node-fstream-ignore node-github-url-from-git   node-glob node-graceful-fs node-gyp node-inherits node-ini   node-json-stringify-safe node-lockfile node-lru-cache node-mime   node-minimatch node-mkdirp node-mute-stream node-node-uuid node-nopt   node-normalize-package-data node-npmlog node-once node-osenv node-qs   node-read node-read-package-json node-request node-retry node-rimraf   node-semver node-sha node-sigmund node-slide node-tar node-tunnel-agent   node-which nodejs-dev npm 0 upgraded, 46 newly installed, 0 remove , 656 not upgraded. need 0 b/945 kb of archives. after operation, 4,780 kb of additional disk space used. want continue? [y/n] y e: invalid archive signature e: internal error, not locate member control.tar.{gzbz2xzlzma} e: prior errors apply /var/cache/apt/archives/node-fstream_0.1.24-1_all.deb e: prior errors apply /var/cache/apt/archives/node-lru-cache_2.3.1-1_all.deb e: prior errors apply /var/cache/apt/archives/node-sigmund_1.0.0-1_all.deb e: prior errors apply /var/cache/apt/archives/node-minimatch_0.2.12-1_all.deb e: prior errors apply /var/cache/apt/archives/node-fstream-ignore_0.0.6-2_all.deb e: prior errors apply /var/cache/apt/archives/node-github-url-from-git_1.1.1-1_all.deb e: prior errors apply /var/cache/apt/archives/node-glob_3.2.6-1_all.deb e: prior errors apply /var/cache/apt/archives/nodejs-dev_0.10.25~dfsg2-2ubuntu1_amd64.deb e: prior errors apply /var/cache/apt/archives/node-nopt_2.1.2-1_all.deb e: prior errors apply /var/cache/apt/archives/node-npmlog_0.0.4-1_all.deb e: prior errors apply /var/cache/apt/archives/node-osenv_0.0.3-1_all.deb e: prior errors apply /var/cache/apt/archives/node-tunnel-agent_0.3.1-1_all.deb e: prior errors apply /var/cache/apt/archives/node-json-stringify-safe_5.0.0-1_all.deb e: prior errors apply /var/cache/apt/archives/node-qs_0.6.5-1_all.deb debconf: apt-extracttemplates failed: no such file or directory extracting templates packages: 100% selecting unselected package node-async. (reading database ... 194080 files , directories installed.) preparing unpack .../node-async_0.2.5-1_all.deb ... unpacking node-async (0.2.5-1) ... selecting unselected package node-node-uuid. preparing unpack .../node-node-uuid_1.4.0-1_all.deb ... unpacking node-node-uuid (1.4.0-1) ... selecting unselected package node-abbrev. preparing unpack .../node-abbrev_1.0.4-2_all.deb ... unpacking node-abbrev (1.0.4-2) ... selecting unselected package node-ansi. preparing unpack .../node-ansi_0.2.1-1_all.deb ... unpacking node-ansi (0.2.1-1) ... selecting unselected package node-archy. preparing unpack .../node-archy_0.0.2-1_all.deb ... unpacking node-archy (0.0.2-1) ... selecting unselected package node-inherits. preparing unpack .../node-inherits_2.0.0-1_all.deb ... unpacking node-inherits (2.0.0-1) ... selecting unselected package node-block-stream. preparing unpack .../node-block-stream_0.0.7-1_all.deb ... unpacking node-block-stream (0.0.7-1) ... selecting unselected package node-delayed-stream. preparing unpack .../node-delayed-stream_0.0.5-1_all.deb ... unpacking node-delayed-stream (0.0.5-1) ... selecting unselected package node-combined-stream. preparing unpack .../node-combined-stream_0.0.4-1_all.deb ... unpacking node-combined-stream (0.0.4-1) ... selecting unselected package node-cookie-jar. preparing unpack .../node-cookie-jar_0.3.1-1_all.deb ... unpacking node-cookie-jar (0.3.1-1) ... selecting unselected package node-forever-agent. preparing unpack .../node-forever-agent_0.5.1-1_all.deb ... unpacking node-forever-agent (0.5.1-1) ... selecting unselected package node-mime. preparing unpack .../node-mime_1.2.11-1_all.deb ... unpacking node-mime (1.2.11-1) ... selecting unselected package node-form-data. preparing unpack .../node-form-data_0.1.0-1_all.deb ... unpacking node-form-data (0.1.0-1) ... selecting unselected package node-rimraf. preparing unpack .../node-rimraf_2.2.2-2_all.deb ... unpacking node-rimraf (2.2.2-2) ... selecting unselected package node-mkdirp. preparing unpack .../node-mkdirp_0.3.5-1_all.deb ... unpacking node-mkdirp (0.3.5-1) ... selecting unselected package node-graceful-fs. preparing unpack .../node-graceful-fs_2.0.0-2_all.deb ... unpacking node-graceful-fs (2.0.0-2) ... dpkg-deb: error: `/var/cache/apt/archives/node-fstream_0.1.24-1_all.deb' not debian format archive dpkg: error processing archive /var/cache/apt/archives/node-fstream_0.1.24-1_all.deb (--unpack):  subprocess dpkg-deb --control returned error exit status 2 selecting unselected package node-lru-cache. preparing unpack .../node-lru-cache_2.3.1-1_all.deb ... unpacking node-lru-cache (2.3.1-1) ... selecting unselected package node-sigmund. preparing unpack .../node-sigmund_1.0.0-1_all.deb ... unpacking node-sigmund (1.0.0-1) ... selecting unselected package node-minimatch. preparing unpack .../node-minimatch_0.2.12-1_all.deb ... unpacking node-minimatch (0.2.12-1) ... selecting unselected package node-fstream-ignore. preparing unpack .../node-fstream-ignore_0.0.6-2_all.deb ... unpacking node-fstream-ignore (0.0.6-2) ... selecting unselected package node-github-url-from-git. preparing unpack .../node-github-url-from-git_1.1.1-1_all.deb ... unpacking node-github-url-from-git (1.1.1-1) ... selecting unselected package node-glob. preparing unpack .../node-glob_3.2.6-1_all.deb ... unpacking node-glob (3.2.6-1) ... selecting unselected package nodejs-dev. preparing unpack .../nodejs-dev_0.10.25~dfsg2-2ubuntu1_amd64.deb ... unpacking nodejs-dev (0.10.25~dfsg2-2ubuntu1) ... selecting unselected package node-nopt. preparing unpack .../node-nopt_2.1.2-1_all.deb ... unpacking node-nopt (2.1.2-1) ... selecting unselected package node-npmlog. preparing unpack .../node-npmlog_0.0.4-1_all.deb ... unpacking node-npmlog (0.0.4-1) ... selecting unselected package node-osenv. preparing unpack .../node-osenv_0.0.3-1_all.deb ... unpacking node-osenv (0.0.3-1) ... selecting unselected package node-tunnel-agent. preparing unpack .../node-tunnel-agent_0.3.1-1_all.deb ... unpacking node-tunnel-agent (0.3.1-1) ... selecting unselected package node-json-stringify-safe. preparing unpack .../node-json-stringify-safe_5.0.0-1_all.deb ... unpacking node-json-stringify-safe (5.0.0-1) ... selecting unselected package node-qs. preparing unpack .../node-qs_0.6.5-1_all.deb ... unpacking node-qs (0.6.5-1) ... selecting unselected package node-request. preparing unpack .../node-request_2.26.1-1_all.deb ... unpacking node-request (2.26.1-1) ... selecting unselected package node-semver. preparing unpack .../node-semver_2.1.0-2_all.deb ... unpacking node-semver (2.1.0-2) ... selecting unselected package node-tar. preparing unpack .../node-tar_0.1.18-1_all.deb ... unpacking node-tar (0.1.18-1) ... selecting unselected package node-which. preparing unpack .../node-which_1.0.5-2_all.deb ... unpacking node-which (1.0.5-2) ... selecting unselected package node-gyp. preparing unpack .../node-gyp_0.10.10-2_all.deb ... unpacking node-gyp (0.10.10-2) ... selecting unselected package node-ini. preparing unpack .../node-ini_1.1.0-1_all.deb ... unpacking node-ini (1.1.0-1) ... selecting unselected package node-lockfile. preparing unpack .../node-lockfile_0.4.1-1_all.deb ... unpacking node-lockfile (0.4.1-1) ... selecting unselected package node-mute-stream. preparing unpack .../node-mute-stream_0.0.3-1_all.deb ... unpacking node-mute-stream (0.0.3-1) ... selecting unselected package node-normalize-package-data. preparing unpack .../node-normalize-package-data_0.2.2-1_all.deb ... unpacking node-normalize-package-data (0.2.2-1) ... selecting unselected package node-once. preparing unpack .../node-once_1.1.1-1_all.deb ... unpacking node-once (1.1.1-1) ... selecting unselected package node-read. preparing unpack .../node-read_1.0.4-1_all.deb ... unpacking node-read (1.0.4-1) ... selecting unselected package node-read-package-json. preparing unpack .../node-read-package-json_1.1.3-1_all.deb ... unpacking node-read-package-json (1.1.3-1) ... selecting unselected package node-retry. preparing unpack .../node-retry_0.6.0-1_all.deb ... unpacking node-retry (0.6.0-1) ... selecting unselected package node-sha. preparing unpack .../node-sha_1.2.3-1_all.deb ... unpacking node-sha (1.2.3-1) ... selecting unselected package node-slide. preparing unpack .../node-slide_1.1.4-1_all.deb ... unpacking node-slide (1.1.4-1) ... selecting unselected package npm. preparing unpack .../npm_1.3.10~dfsg-1_all.deb ... unpacking npm (1.3.10~dfsg-1) ... processing triggers man-db (2.6.7.1-1) ... processing triggers doc-base (0.10.5) ... processing 4 added doc-base files... errors encountered while processing:  /var/cache/apt/archives/node-fstream_0.1.24-1_all.deb e: sub-process /usr/bin/dpkg returned error code (1) 

when ran npm install -g mocha getting following error.

user@dell:~/mochatest$

user@dell:~/mochatest$ npm install -g mocha npm err! error: cannot find module 'fstream' npm err!     @ function.module._resolvefilename (module.js:338:15) npm err!     @ function.module._load (module.js:280:25) npm err!     @ module.require (module.js:364:17) npm err!     @ require (module.js:380:17) npm err!     @ object.<anonymous> (/usr/lib/nodejs/tar/lib/entry.js:14:15) npm err!     @ module._compile (module.js:456:26) npm err!     @ object.module._extensions..js (module.js:474:10) npm err!     @ module.load (module.js:356:32) npm err!     @ function.module._load (module.js:312:12) npm err!     @ module.require (module.js:364:17) npm err! if need help, may report log at: npm err!     <http://github.com/isaacs/npm/issues> npm err! or email to: npm err!     <npm-@googlegroups.com>  npm err! system linux 3.13.0-36-generic npm err! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "mocha" npm err! cwd /home/user//mochatest npm err! node -v v0.10.25 npm err! npm -v 1.3.10 npm err! code module_not_found npm err!  npm err! additional logging details can found in: npm err!     /home/mochatest/npm-debug.log npm err! not ok code 0 

you need use sudo install npm packages globally in ubuntu. try

sudo npm install -g mocha 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -