Skip to content

[BUG] npm ci lists npm install flags that don't work for npm ci #6319

@richardebeling

Description

@richardebeling

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

$ npm ci --global
npm ERR! code ECIGLOBAL
npm ERR! `npm ci` does not work for global packages

Expected Behavior

The documentation says that the global flag is allowed:

Operates in "global" mode, so that packages are installed into the prefix folder instead of the current working directory. See folders for more on the differences in behavior.

  • packages are installed into the {prefix}/lib/node_modules folder, instead of the current working directory.
  • bin files are linked to {prefix}/bin
  • man pages are linked to {prefix}/share/man

Steps To Reproduce

  1. execute npm ci -g.

Environment

The code raising the error is here:

cli/lib/commands/ci.js

Lines 18 to 22 in 1c3612c

if (this.npm.global) {
throw Object.assign(new Error('`npm ci` does not work for global packages'), {
code: 'ECIGLOBAL',
})
}

and there are tests for this:

cli/test/lib/commands/ci.js

Lines 184 to 189 in 1c3612c

t.test('should throw ECIGLOBAL', async t => {
const { npm } = await loadMockNpm(t, {
config: { global: true },
})
await t.rejects(npm.exec('ci', []), { code: 'ECIGLOBAL' })
})

so I guess my environment doesn't matter here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Documentationdocumentation related issueNeeds Triageneeds review for next stepsPriority 2secondary priority issueRelease 9.xwork is associated with a specific npm 9 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions