Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.bugs.dist > #1024473

Bug#969986: [Pkg-javascript-devel] Bug#969986: Bug#969986: npm: Error: Cannot find module 'semver'

From Kevin Locke <kevin@kevinlocke.name>
Newsgroups linux.debian.bugs.dist
Subject Bug#969986: [Pkg-javascript-devel] Bug#969986: Bug#969986: npm: Error: Cannot find module 'semver'
Date 2020-09-09 22:20 +0200
Message-ID <ANeJs-5cx-5@gated-at.bofh.it> (permalink)
References (2 earlier) <ANcxX-3HQ-5@gated-at.bofh.it> <ANdkm-4eK-5@gated-at.bofh.it> <ANdNn-4DO-3@gated-at.bofh.it> <ANcxX-3HQ-5@gated-at.bofh.it> <ANdNn-4DO-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

reassign 969986 nodejs
merge 969986 932659
thanks

On Wed, 2020-09-09 at 21:11 +0200, Jonas Smedegaard wrote:
> Quoting Kevin Locke (2020-09-09 20:32:01)
>> Did you try installing to a chroot:
>> 
>> debootstrap testing npm-chroot && chroot npm-chroot sh -c 'apt install -y npm && npm --version'
> 
> I tried above command just now (inside another chroot), and it failed:
>
> [...]
> Error: Cannot find module 'semver'
> [...]
> 
> Installing npm into a clean pbuilder chroot (either sid or bullseye) and 
> running "npm --version" does not fail, however.

Good catch.  I am seeing the same behavior.  It looks to me like a
difference in the node module search path, not specific to npm.

If I run `node -e 'console.log(require.resolve.paths("semver"))'` in the
chroot, I get (note the missing /usr prefix):

[
  '/node_modules',
  '/root/.node_modules',
  '/root/.node_libraries',
  '/lib/x86_64-linux-gnu/nodejs',
  '/share/nodejs',
  '/lib/nodejs'
]

In pbuilder I get:

[
  '/node_modules',
  '/root/.node_modules',
  '/root/.node_libraries',
  '/usr/lib/x86_64-linux-gnu/nodejs',
  '/usr/share/nodejs',
  '/usr/lib/nodejs'
]

I think the problem is that process.execPath is "node" in the chroot and
"/usr/bin/node" in pbuilder and that this is used to build the module
search path.  The problem occurs when /proc is not mounted.

It appears this was already reported in #932659.  Sorry for not noticing
that earlier.

Thanks,
Kevin

Back to linux.debian.bugs.dist | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Bug#969986: npm: Error: Cannot find module 'semver' Kevin Locke <kevin@kevinlocke.name> - 2020-09-09 20:00 +0200
  Bug#969986: [Pkg-javascript-devel] Bug#969986: npm: Error: Cannot find module 'semver' Xavier <yadd@debian.org> - 2020-09-09 20:40 +0200
    Bug#969986: [Pkg-javascript-devel] Bug#969986: npm: Error: Cannot find module 'semver' Kevin Locke <kevin@kevinlocke.name> - 2020-09-09 20:50 +0200
      Bug#969986: [Pkg-javascript-devel] Bug#969986: Bug#969986: npm: Error: Cannot find module 'semver' Jonas Smedegaard <jonas@jones.dk> - 2020-09-09 21:20 +0200
        Bug#969986: [Pkg-javascript-devel] Bug#969986: Bug#969986: npm: Error: Cannot find module 'semver' Kevin Locke <kevin@kevinlocke.name> - 2020-09-09 22:20 +0200

csiph-web