Npm Install Notes
When I uploaded my latest post,
I got a note from Firebase saying a new version was available. I entered the suggested
command, and npm
was not found:
=== Deploying to 'agitatedheart'...
i deploying hosting
i hosting[agitatedheart]: beginning deploy...
i hosting[agitatedheart]: found 47 files in public
✔ hosting[agitatedheart]: file upload complete
i hosting[agitatedheart]: finalizing version...
✔ hosting[agitatedheart]: version finalized
i hosting[agitatedheart]: releasing new version...
✔ hosting[agitatedheart]: release complete
✔ Deploy complete!
Project Console: https://console.firebase.google.com/project/agitatedheart/overview
Hosting URL: https://agitatedheart.web.app
╭─────────────────────────────────────────────────────────────────────────╮
│ │
│ Update available 11.20.0 → 11.21.0 │
│ To update to the latest version using npm, run │
│ npm install -g firebase-tools │
│ │
╰─────────────────────────────────────────────────────────────────────────╯
bnc@L00129-2:~/agitatedheart$ npm install -g firebase-tools
-bash: /usr/bin/npm: No such file or directory
I run a relatively new instance of Ubuntu 22.04 under WSL2 on my Windows box, so it didn’t surprise me too much that everything isn’t quite up to date.
First off I tried sudo apt install npm
as one might, but I got a boatload of dependency warnings:
bnc@L00129-2:~/agitatedheart$ sudo apt install npm
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
npm : Depends: node-agent-base but it is not going to be installed
Depends: node-aproba but it is not going to be installed
Depends: node-archy but it is not going to be installed
Depends: node-cacache but it is not going to be installed
...
Depends: node-tar but it is not going to be installed
Depends: node-validate-npm-package-name but it is not going to be installed
Depends: node-which but it is not going to be installed
Depends: node-write-file-atomic but it is not going to be installed
Depends: nodejs:any (>= 10)
Recommends: node-tap but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
I tried a few other reasonable approaches, but couldn’t find the right combination.
A quick search of Stack Overflow had the answer -
switch to aptitude
, which will try to resolve the problem. Bingo:
bnc@L00129-2:~/agitatedheart$ sudo apt-get install aptitude
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
aptitude-common libboost-iostreams1.74.0 libcwidget4 libsigc++-2.0-0v5 libxapian30
Suggested packages:
apt-xapian-index aptitude-doc-en | aptitude-doc debtags tasksel libcwidget-dev xapian-tools
The following NEW packages will be installed:
aptitude aptitude-common libboost-iostreams1.74.0 libcwidget4 libsigc++-2.0-0v5 libxapian30
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 4083 kB of archives.
After this operation, 19.5 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://archive.ubuntu.com/ubuntu jammy/universe amd64 aptitude-common all 0.8.13-3ubuntu1 [1719 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy/main amd64 libboost-iostreams1.74.0 amd64 1.74.0-14ubuntu3 [245 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy/main amd64 libsigc++-2.0-0v5 amd64 2.10.4-2ubuntu3 [12.1 kB]
Get:4 http://archive.ubuntu.com/ubuntu jammy/universe amd64 libcwidget4 amd64 0.5.18-5build1 [306 kB]
Get:5 http://archive.ubuntu.com/ubuntu jammy/universe amd64 libxapian30 amd64 1.4.18-4 [701 kB]
Get:6 http://archive.ubuntu.com/ubuntu jammy/universe amd64 aptitude amd64 0.8.13-3ubuntu1 [1100 kB]
Fetched 4083 kB in 2s (2610 kB/s)
Selecting previously unselected package aptitude-common.
(Reading database ... 43561 files and directories currently installed.)
Preparing to unpack .../0-aptitude-common_0.8.13-3ubuntu1_all.deb ...
Unpacking aptitude-common (0.8.13-3ubuntu1) ...
Selecting previously unselected package libboost-iostreams1.74.0:amd64.
Preparing to unpack .../1-libboost-iostreams1.74.0_1.74.0-14ubuntu3_amd64.deb ...
Unpacking libboost-iostreams1.74.0:amd64 (1.74.0-14ubuntu3) ...
Selecting previously unselected package libsigc++-2.0-0v5:amd64.
Preparing to unpack .../2-libsigc++-2.0-0v5_2.10.4-2ubuntu3_amd64.deb ...
Unpacking libsigc++-2.0-0v5:amd64 (2.10.4-2ubuntu3) ...
Selecting previously unselected package libcwidget4:amd64.
Preparing to unpack .../3-libcwidget4_0.5.18-5build1_amd64.deb ...
Unpacking libcwidget4:amd64 (0.5.18-5build1) ...
Selecting previously unselected package libxapian30:amd64.
Preparing to unpack .../4-libxapian30_1.4.18-4_amd64.deb ...
Unpacking libxapian30:amd64 (1.4.18-4) ...
Selecting previously unselected package aptitude.
Preparing to unpack .../5-aptitude_0.8.13-3ubuntu1_amd64.deb ...
Unpacking aptitude (0.8.13-3ubuntu1) ...
Setting up libxapian30:amd64 (1.4.18-4) ...
Setting up libboost-iostreams1.74.0:amd64 (1.74.0-14ubuntu3) ...
Setting up libsigc++-2.0-0v5:amd64 (2.10.4-2ubuntu3) ...
Setting up aptitude-common (0.8.13-3ubuntu1) ...
Setting up libcwidget4:amd64 (0.5.18-5build1) ...
Setting up aptitude (0.8.13-3ubuntu1) ...
update-alternatives: using /usr/bin/aptitude-curses to provide /usr/bin/aptitude (aptitude) in auto mode
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
After installing aptitude
I used it to install npm
:
bnc@L00129-2:~/agitatedheart$ sudo aptitude install npm
The following NEW packages will be installed:
libjs-events{a} libjs-inherits{a} libjs-is-typedarray{a} libjs-typedarray-to-buffer{a} node-abbrev{a} node-agent-base{a} node-ansi-regex{a} node-ansi-styles{a}
node-ansistyles{a} node-aproba{a} node-archy{a} node-are-we-there-yet{a} node-asap{a} node-balanced-match{a} node-brace-expansion{a} node-builtins{a} node-chalk{a}
node-chownr{a} node-cli-table{a} node-clone{a} node-color-convert{a} node-color-name{a} node-colors{a} node-columnify{a} node-console-control-strings{a}
node-core-util-is{a} node-debug{a} node-decompress-response{a} node-defaults{a} node-delegates{a} node-depd{a} node-encoding{a} node-end-of-stream{a} node-err-code{a}
node-escape-string-regexp{a} node-events{a} node-fancy-log{a} node-fs.realpath{a} node-function-bind{a} node-gauge{a} node-get-stream{a} node-glob{a} node-got{a}
node-graceful-fs{a} node-has-flag{a} node-has-unicode{a} node-hosted-git-info{a} node-https-proxy-agent{a} node-iconv-lite{a} node-imurmurhash{a} node-inflight{a}
node-inherits{a} node-ini{a} node-ip{a} node-ip-regex{a} node-is-typedarray{a} node-isarray{a} node-json-buffer{a} node-json-parse-better-errors{a} node-jsonparse{a}
node-lowercase-keys{a} node-lru-cache{a} node-mimic-response{a} node-minimatch{a} node-minipass{a} node-ms{a} node-mute-stream{a} node-negotiator{a}
node-normalize-package-data{a} node-npm-bundled{a} node-npm-package-arg{a} node-npmlog{a} node-object-assign{a} node-once{a} node-osenv{a} node-p-cancelable{a}
node-path-is-absolute{a} node-process-nextick-args{a} node-promise-retry{a} node-promzard{a} node-pump{a} node-quick-lru{a} node-read{a} node-read-package-json{a}
node-readable-stream{a} node-resolve{a} node-retry{a} node-rimraf{a} node-safe-buffer{a} node-semver{a} node-set-blocking{a} node-signal-exit{a} node-slash{a}
node-slice-ansi{a} node-spdx-correct{a} node-spdx-exceptions{a} node-spdx-expression-parse{a} node-spdx-license-ids{a} node-ssri{a} node-string-decoder{a}
node-string-width{a} node-strip-ansi{a} node-supports-color{a} node-text-table{a} node-time-stamp{a} node-typedarray-to-buffer{a} node-util-deprecate{a}
node-validate-npm-package-license{a} node-validate-npm-package-name{a} node-wcwidth.js{a} node-wide-align{a} node-wrappy{a} node-write-file-atomic{a} node-yallist{a}
npm{b}
0 packages upgraded, 115 newly installed, 0 to remove and 0 not upgraded.
Need to get 2228 kB of archives. After unpacking 7606 kB will be used.
The following packages have unmet dependencies:
npm : Depends: node-cacache but it is not installable
Depends: node-gyp but it is not installable
Depends: node-mkdirp but it is not installable
Depends: node-nopt but it is not installable
Depends: node-tar but it is not installable
Depends: node-which but it is not installable
Depends: nodejs:any (>= 10) which is a virtual package, provided by:
- nodejs (12.22.9~dfsg-1ubuntu3), but 18.13.0-deb-1nodesource1 is installed
nodejs : Conflicts: npm but 8.5.1~ds-1 is to be installed
The following actions will resolve these dependencies:
Keep the following packages at their current version:
1) npm [Not Installed]
Accept this solution? [Y/n/q/?] Y
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
I’m not sure what changes were actually made here, but afterwards I was able to install
the Firebase update using the npm
command it had provided:
bnc@L00129-2:~/agitatedheart$ sudo npm install -g firebase-tools
npm WARN deprecated har-validator@5.1.3: this library is no longer supported
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
added 649 packages, and audited 650 packages in 13s
41 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
UPDATE
Even after running the npm
command shown above, firebase had not been updated. I dug a little, and came up
with this command to force an update to the latest version:
curl -sL https://firebase.tools | upgrade=true bash
It worked as expected and firebase
now returns the correct version:
bnc@L00129-2:~/agitatedheart$ firebase --version
11.21.0