tensor5 / arch-atom

Repository of Atom and Electron binary packages for Arch Linux
48 stars 5 forks source link

apm: Use system npm #27

Closed City-busz closed 8 years ago

City-busz commented 8 years ago

I think we can use npm and node-gyp installed on the system rather than bundle one.

tensor5 commented 8 years ago

I was planning on it!

In order to use system npm, we also require to replace require('npm') and similar with require('/usr/lib/node_modules/npm'); /usr/lib/node_modules is not in Node search list.

Btw, I'm working on upgrading to Electron 1.3.0, and there is a major problem making Atom compile with it (https://github.com/nodegit/nodegit/issues/1089). I will merge PRs after I'm done with it.

City-busz commented 8 years ago

I think it works for me without replacing require('npm')

tensor5 commented 8 years ago

I get

module.js:442
    throw err;
    ^

Error: Cannot find module 'npm'
    at Function.Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/nicola/abs/atom/apm/src/apm-build/usr/lib/node_modules/atom-package-manager/lib/apm-cli.js:12:9)
    at Object.<anonymous> (/home/nicola/abs/atom/apm/src/apm-build/usr/lib/node_modules/atom-package-manager/lib/apm-cli.js:237:4)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
City-busz commented 8 years ago

It looks like it fails to run from a custom directory, but works fine when it installed on the system. Try again by installing the package. (I added back python2 to dependencies.)

tensor5 commented 8 years ago

Ah yes, it searches ../../../node_modules (Node keeps adding ../ until it reaches the root).