2

Trying to run sudo apt install node-acorn produces an error:

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: node-acorn : Depends: nodejs:any or nodejs (< 12.22.5~dfsg-4~) but 18.14.2-deb-1nodesource1 is to be installed E: Unable to correct problems, you have held broken packages.

I am on Ubuntu 22.04. I have the current LTS version (18.14.2) of nodejs installed, but it seems there is some misconfiguration either on my part or on the side of node-acorn packagers. I also have acorn installed via npm, but I want to install emscripten, which has node-acorn as a dependency (the npm copy doesn't seem to matter to it). Do you have any suggestions on how to fix this issue?

Here is the output of apt show node-acorn -a:

Version: 8.7.0+ds+~cs24.17.6-1
Priority: optional
Section: universe/javascript
Source: acorn
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian Javascript Maintainers <pkg-javascript-devel@lists.alioth.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 972 kB
Provides: node-acorn-bigint (= 1.0.0), node-acorn-class-fields (= 1.0.0), node-acorn-dynamic-import (= 4.0.0), node-acorn-export-ns-from (= 0.2.0), node-acorn-globals (= 6.0.0), node-acorn-import-assertions (= 1.8.0), node-acorn-import-meta (= 1.1.0), node-acorn-jsx (= 5.3.1), node-acorn-loose (= 8.2.1), node-acorn-node (= 2.0.1), node-acorn-numeric-separator (= 0.3.4), node-acorn-private-class-elements (= 1.0.0), node-acorn-private-methods (= 1.0.0), node-acorn-static-class-features (= 1.0.0), node-acorn-walk (= 8.2.0), node-debbundle-acorn (= 8.7.0+ds+~cs24.17.6-1)
Depends: node-xtend, nodejs:any | nodejs (<< 12.22.5~dfsg-4~)
Breaks: node-acorn-dynamic-import (<< 4.0.0~), node-acorn-jsx (<< 5.0.0~), node-acorn-object-spread (<< 6~), node-babel (<< 7), node-debbundle-acorn (<< 8.5.0+ds+~cs24.17.6~), node-espree (<< 6~), node-falafel (<< 2.1.0-9~), webpack (<< 4.28.3~)
Replaces: node-acorn-dynamic-import (<< 4.0.0+really4.0.0~), node-acorn-jsx (<< 5.0.0~), node-debbundle-acorn (<< 8.5.0+ds+~cs24.17.6~)
Homepage: https://github.com/ternjs/acorn/
Download-Size: 117 kB
APT-Sources: http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
Description: ECMAScript parser for Node.js
 Acorn is a tiny, fast JavaScript parser written in JavaScript.
 .
 acorn.js defines the main parser interface. The library also comes with a
 error-tolerant parser and an abstract syntax tree walker, defined in other
 files.
 .
 This package contains the acorn module for Node.js.
 .
 This package contains also small pluggins packages acorn-bigint,
 acorn-dynamic-import, acorn-jsx, acorn-node, acorn-private-class-elements,
 acorn-class-fields, acorn-static-class-features, acorn-export-ns-from,
 acorn-numeric-separator, acorn-private-methods.
 .
 Node.js is an event-based server-side JavaScript engine.

I have worked around the issue by switching to Ubuntu 20.10, wiping out nodejs installation and reinstalling it from Canonical's repository rather than from Nodesource's (Had to use Nodesource with 22.04 because its "native" version was too old.)

  • I want to install emscripten, which has node-acorn as a dependency - If you already installed from npm, create and install a dummy package node-acorn with equivs. https://askubuntu.com/questions/18192/how-to-fake-a-package-version-installed – Archisman Panigrahi Feb 27 '23 at 22:28
  • @ArchismanPanigrahi Well, the npm version installs acorn wherever I'd need its files. I would still need to know how to supply them to emscripten. I might have to go that route as the last resort, but so far I'd rather try to fix apt dependencies or something like that... – Iiro Ullin Feb 27 '23 at 22:53
  • Did you add any external repository (e.g. PPA) for nodejs? – Archisman Panigrahi Feb 27 '23 at 23:25
  • 1
    @ArchismanPanigrahi In a way: mine is from https://deb.nodesource.com/setup_18.x -- its official repository afaik (https://github.com/nodesource/distributions/blob/master/README.md) Ubuntu 22.04 "official" nodejs version is 12.22.9, too old for my needs – Iiro Ullin Feb 27 '23 at 23:46
  • It seems that node-acron is being installed from the Ubuntu 22.04 official repositories, and that is conflicting with the version from node's repository – Archisman Panigrahi Feb 27 '23 at 23:52
  • Possibly. I don't understand though, why on one hand node-acorn has nodejs:any as a dependency, but on the other hand still requires version <12.22.5, which wouldn't match even for 12.22.9 from the Canonical's repository for 22.04 – Iiro Ullin Feb 28 '23 at 03:21
  • Can you post the output of apt show node-acorn -a – Archisman Panigrahi Feb 28 '23 at 04:41
  • @ArchismanPanigrahi Sure, added it to the original post – Iiro Ullin Feb 28 '23 at 14:08

0 Answers0