Skip to content

[BUG] npm version throws TypeError on 'trim'. #2097

@Johannestegner

Description

@Johannestegner

Current Behavior:

When executing npm version {version} or even npm version from-git in my CI pipeline I get the following error:

0 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'version', 'from-git' ]
1 info using [email protected]
2 info using [email protected]
3 timing config:load:defaults Completed in 2ms
4 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 1ms
5 timing config:load:builtin Completed in 1ms
6 timing config:load:cli Completed in 3ms
7 timing config:load:env Completed in 2ms
8 timing config:load:file:/builds/open-source/javascript/eslint-config/.npmrc Completed in 0ms
9 timing config:load:project Completed in 1ms
10 timing config:load:file:/root/.npmrc Completed in 2ms
11 timing config:load:user Completed in 2ms
12 timing config:load:file:/registry.npmjs.org/:_authToken=xxxx
python=/usr/bin/python3 Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:cafile Completed in 1ms
15 timing config:load:validate Completed in 1ms
16 timing config:load:setUserAgent Completed in 1ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 15ms
19 verbose npm-session xxxx
20 timing npm:load Completed in 26ms
21 timing command:version Completed in 24ms
22 verbose stack TypeError: Cannot read property 'trim' of undefined
22 verbose stack     at clean (/usr/local/lib/node_modules/npm/node_modules/semver/functions/clean.js:3:27)
22 verbose stack     at module.exports (/usr/local/lib/node_modules/npm/node_modules/libnpmversion/lib/version.js:38:24)
22 verbose stack     at module.exports (/usr/local/lib/node_modules/npm/node_modules/libnpmversion/lib/index.js:23:10)
22 verbose stack     at async version (/usr/local/lib/node_modules/npm/lib/version.js:40:21)
23 verbose cwd /builds/open-source/javascript/eslint-config
24 verbose Linux 5.4.0-37-generic
25 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "version" "from-git"
26 verbose node v15.0.1
27 verbose npm  v7.0.3
28 error Cannot read property 'trim' of undefined
29 verbose exit 1

Expected Behavior:

The npm package version should be updated to defined version.

Steps To Reproduce:

I use the following docker image (which is built from my ci as well): https://github.com/orgs/jitesoft/packages/container/package/node

The following package is the latest I tried to build: https://github.com/jitesoft/eslint-config

Environment:

OS: Alpine linux
Node: 15.0.1
NPM: 7.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 7.xwork is associated with a specific npm 7 release

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions