Featured packages, apm: TypeError: must call as: npm.load(callback)

Prerequisites

Description

Steps: Open Atom -> Preferences -> Install -> Featured Packages section: there is an error.

/usr/lib/node_modules/npm/lib/npm.js:130
      throw new TypeError('must call as: npm.load(callback)')
      ^

TypeError: must call as: npm.load(callback)
    at Object.load (/usr/lib/node_modules/npm/lib/npm.js:130: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 Featured.module.exports.Featured.getFeaturedPackagesByType (/usr/lib/node_modules/atom-package-manager/lib/featured.js:52:22)
    at Featured.module.exports.Featured.getAllFeaturedPackages (/usr/lib/node_modules/atom-package-manager/lib/featured.js:83:19)
    at Featured.module.exports.Featured.run (/usr/lib/node_modules/atom-package-manager/lib/featured.js:135:21)
    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:1108:14)

If I try to install any package it throws another error:

Installing “tabclick@0.1.0” failed.Hide output…
node:internal/modules/cjs/loader:479
      throw e;
      ^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './bin/npm-cli' is not defined by "exports" in /usr/lib/node_modules/npm/package.json
    at new NodeError (node:internal/errors:329:5)
    at throwExportsNotFound (node:internal/modules/esm/resolve:337:9)
    at packageExportsResolve (node:internal/modules/esm/resolve:562:3)
    at resolveExports (node:internal/modules/cjs/loader:473:36)
    at Function.Module._findPath (node:internal/modules/cjs/loader:513:31)
    at Function.node_module._findPath (/usr/lib/node_modules/atom-package-manager/node_modules/asar-require/lib/require.js:141:32)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:911:27)
    at Function.resolve (node:internal/modules/cjs/helpers:98:19)
    at new Install (/usr/lib/node_modules/atom-package-manager/lib/install.js:53:34)
    at Object.run (/usr/lib/node_modules/atom-package-manager/lib/apm-cli.js:240:18) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Steps to Reproduce

  1. saw error
Error: The module '(idk some local package of atom-package-manager)'
was compiled against a different Node.js version using
NODE_MODULE_VERSION na. This version of Node.js requires
NODE_MODULE_VERSION nb. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`). 
  1. tried npm rebuild: nothing
  2. tried npm install: runs some after-install coffee compiler scripts which throws error, because folder src not found
  3. removed npm global package atom-package-manager
  4. installed again global package
  5. started atom
  6. same error
  7. uninstalled atom
  8. sudo find / -name atom, got
find: ‘/run/user/1000/doc’: Permission denied
find: ‘/run/user/1000/gvfs’: Permission denied
/usr/lib/modules/5.10.15-1-MANJARO/kernel/sound/soc/intel/atom
/usr/include/libgdata/gdata/atom
  1. restarted system
  2. installed fresh new Atom, now getting this errors in description

Expected behavior:

See no errors.

Actual behavior:

See an error.

Reproduces how often:

Everytime.

Versions

atom

ramofx@manjaro ~: $ atom -v
Atom    : 1.54.0
Electron: 6.1.12
Chrome  : 76.0.3809.146
Node    : 12.4.0

apm

ramofx@manjaro ~: $ apm -v
/usr/lib/node_modules/npm/lib/npm.js:130
      throw new TypeError('must call as: npm.load(callback)')
      ^

TypeError: must call as: npm.load(callback)
    at Object.load (/usr/lib/node_modules/npm/lib/npm.js:130:13)
    at getPythonVersion (/usr/lib/node_modules/atom-package-manager/lib/apm-cli.js:155:16)
    at printVersions (/usr/lib/node_modules/atom-package-manager/lib/apm-cli.js:94:12)
    at Object.run (/usr/lib/node_modules/atom-package-manager/lib/apm-cli.js:223:16)
    at Object.<anonymous> (/usr/lib/node_modules/atom-package-manager/bin/apm:9:30)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:973:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)

npm

ramofx@manjaro ~/Projects/app/web/tools: $ npm -v
7.5.4

OS

OS Name: Manjaro Linux; Build ID: rolling
OS Type: 64-bit
GNOME Version: 3.38.3
Windowing System: Wayland
Up to date.

Additional Information

I can provide more information if you need or I am something missing, I really love Atom, because it is so simple and flexible, because of that reasons I just can’t switch to another editor like Brackets, VSC, Sublime text, Webstorm, …

update: added npm version

2 thoughts on “Featured packages, apm: TypeError: must call as: npm.load(callback)

  1. Resolved.

    Made some mess with manual installing or rebuilding atom-package-manager.

    sudo pacman -Rsn atom
    sudo pacman -S atom
    

    ** works now **

  2. Resolved.

    Made some mess with manual installing or rebuilding atom-package-manager.

    sudo pacman -Rsn atom
    sudo pacman -S atom
    

    ** works now **

    I had the same problem and it worked for me, thanks!