FS#69844 - [apm] apm requires npm less than 7, so 6.14

Attached to Project: Community Packages
Opened by Solomon Choina (SolarAquarion) - Monday, 01 March 2021, 14:17 GMT
Last edited by Nicola Squartini (tensor5) - Thursday, 04 March 2021, 16:03 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Nicola Squartini (tensor5)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Description: If one installed npm greater then 7, installations via apm will not work.
This task depends upon

Closed by  Nicola Squartini (tensor5)
Thursday, 04 March 2021, 16:03 GMT
Reason for closing:  Fixed
Additional comments about closing:  2.6.1-2
Comment by Fernando Cordeiro (Frnco) - Wednesday, 03 March 2021, 23:25 GMT
Uninstalling both atom and apm, then installing apm-community from AUR did nothing to solve the issue.

This was DEFINITELY overkill but I downloaded the APM source-code, having neither apm nor atom installed, and followed the steps on the "building" section in the apm repository's Readme, had problems because I had a version manager installed, removed the goddamned version manager from $PATH, tried again as user (using system node and npm), ran the tests and everything passed, then tried apm search aaaand... It works. APM from git master branch Works with current system NPM and NodeJS, installing as user.

For completeness, I deleted the node_modules folder, did git checkout v2.6.1, and then ran npm install again, and it installed fine, npm build worked fine, and did apm search and it worked fine, so tag v2.6.1 works with system node and system npm.

Then I ran npm test and the tests failed, failing to find a node_module, except I checked every file mentioned and everything was ok, so I have no idea why the heck it fails,but since other than the test everything works, I figured the problem obviously lies on the Arch/pacman side of things.

Then I reinstalled apm from pacman and tried running a search and the error reappeared. I decoded to go for the quick and dirty solution of compiling everything myself at least for now, but I pasted the stack trace below in case it contains useful information for anyone else, though I have no idea how or even if there's a way to properly format the code, if there is I'd love if someone enlightened me.

TypeError: must call as: npm.load(callback)
at Object.load (/usr/lib/node_modules/npm/lib/npm.js:135:13)
at loadNpm (/usr/lib/node_modules/atom-package-manager/lib/request.js:17:16)
at configureRequest (/usr/lib/node_modules/atom-package-manager/lib/request.js:21:12)
at Object.get (/usr/lib/node_modules/atom-package-manager/lib/request.js:42:14)
at Search.module.exports.Search.searchPackages (/usr/lib/node_modules/atom-package-manager/lib/search.js:55:22)
at Search.module.exports.Search.run (/usr/lib/node_modules/atom-package-manager/lib/search.js:102:19)
at Object.run (/usr/lib/node_modules/atom-package-manager/lib/apm-cli.js:240:32)
at Object.<anonymous> (/usr/lib/node_modules/atom-package-manager/bin/apm:9:30)
at Module._compile (node:internal/modules/cjs/loader:1092:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)

P.S.: If by any chance reproducing the problem happens to be hard, I'm willing to help as much as I can.