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

Kevin Locke kevin at kevinlocke.name
Wed Sep 9 19:32:01 BST 2020


On Wed, 2020-09-09 at 20:20 +0200, Xavier wrote:
> Control: tags -1 + moreinfo
> 
> Le 09/09/2020 à 19:54, Kevin Locke a écrit :
>> Package: npm
>> Version: 6.14.8+ds-1
>> Severity: important
>> 
>> Dear Maintainer,
>> 
>> When I run `npm --version` (or any subcommand), it prints:
>> 
>> internal/modules/cjs/loader.js:968
>>   throw err;
>>   ^
>> 
>> Error: Cannot find module 'semver'
>> Require stack:
>> - /usr/share/npm/lib/utils/unsupported.js
>> - /usr/share/npm/bin/npm-cli.js
>>     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
>>     at Function.Module._load (internal/modules/cjs/loader.js:841:27)
>>     at Module.require (internal/modules/cjs/loader.js:1025:19)
>>     at require (internal/modules/cjs/helpers.js:72:18)
>>     at Object.<anonymous> (/usr/share/npm/lib/utils/unsupported.js:2:14)
>>     at Module._compile (internal/modules/cjs/loader.js:1137:30)
>>     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
>>     at Module.load (internal/modules/cjs/loader.js:985:32)
>>     at Function.Module._load (internal/modules/cjs/loader.js:878:14)
>>     at Module.require (internal/modules/cjs/loader.js:1025:19) {
>>   code: 'MODULE_NOT_FOUND',
>>   requireStack: [
>>     '/usr/share/npm/lib/utils/unsupported.js',
>>     '/usr/share/npm/bin/npm-cli.js'
>>   ]
>> }
>> 
>> I am able to reproduce the error in a fresh chroot with:
>> 
>> debootstrap testing npm-chroot
>> chroot npm-chroot sh -c 'apt install -y npm && npm --version'
>> 
>> Any ideas?
> 
> Hi,
> 
> I'm unable to reproduce this bug when adding this autopkgtest
> (node-semver is a dependency of npm):
> 
> Test-Command: npm --version
> Depends: @
> Restrictions: superficial
> Features: test-name=npm-version
> 
> 
> Result is:
> autopkgtest [20:16:49]: test npm-version: npm --version
> autopkgtest [20:16:49]: test npm-version: [-----------------------
> 6.14.8
> autopkgtest [20:16:49]: test npm-version: -----------------------]
> autopkgtest [20:16:49]: test npm-version:  - - - - - - - - - - results
> npm-version          PASS (superficial)

I'm sorry, but I'm not familiar enough with autopkgtest to confirm.
I'll start reading about autopkgtest to see if I can confirm or come up
with a repro.

Did you try installing to a chroot:

debootstrap testing npm-chroot && chroot npm-chroot sh -c 'apt install -y npm && npm --version'

Thanks,
Kevin



More information about the Pkg-javascript-devel mailing list