Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 tasks done
richardebeling opened this issue Apr 3, 2023 · 3 comments · Fixed by #6322
Closed
2 tasks done

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

richardebeling opened this issue Apr 3, 2023 · 3 comments · Fixed by #6322
Labels
Documentation documentation related issue Needs Triage needs review for next steps Priority 2 secondary priority issue Release 9.x work is associated with a specific npm 9 release

Comments

@richardebeling
Copy link

richardebeling commented Apr 3, 2023

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.

@richardebeling richardebeling added Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release labels Apr 3, 2023
@ljharb
Copy link
Contributor

ljharb commented Apr 3, 2023

npm ci only makes sense with a lockfile, and there isn't a global lockfile, so it shouldn't work.

@richardebeling
Copy link
Author

From the documentation, I would have expected it to use the lockfile in the current working directory.

@ljharb
Copy link
Contributor

ljharb commented Apr 3, 2023

That would be npm ci, then, since -g explicitly means "global, not the current working directory".

@wraithgar wraithgar added Documentation documentation related issue Priority 2 secondary priority issue and removed Bug thing that needs fixing labels Apr 3, 2023
@wraithgar wraithgar changed the title [BUG] npm ci --global causes ECIGLOBAL error although documentation suggests it should work [BUG] npm ci lists npm install flags that don't work for npm ci Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation documentation related issue Needs Triage needs review for next steps Priority 2 secondary priority issue Release 9.x work is associated with a specific npm 9 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants