diff --git a/lib/cli/entry.js b/lib/cli/entry.js index ed73eb89e2d36..f36bc59feaec9 100644 --- a/lib/cli/entry.js +++ b/lib/cli/entry.js @@ -6,11 +6,6 @@ module.exports = async (process, validateEngines) => { // leak any private CLI configs to other programs process.title = 'npm' - // if npm is called as "npmg" or "npm_g", then run in global mode. - if (process.argv[1][process.argv[1].length - 1] === 'g') { - process.argv.splice(1, 1, 'npm', '-g') - } - // Patch the global fs module here at the app level require('graceful-fs').gracefulify(require('node:fs')) diff --git a/test/lib/cli/entry.js b/test/lib/cli/entry.js index 900e3ab794317..369927dace0f2 100644 --- a/test/lib/cli/entry.js +++ b/test/lib/cli/entry.js @@ -35,16 +35,16 @@ const cliMock = async (t, opts) => { } } -t.test('print the version, and treat npm_g as npm -g', async t => { +t.test('print the version ', async t => { const { logs, cli, Npm, outputs, exitHandlerCalled } = await cliMock(t, { - globals: { 'process.argv': ['node', 'npm_g', 'root'] }, + globals: { 'process.argv': ['node', 'npm', 'root'] }, }) await cli(process) - t.strictSame(process.argv, ['node', 'npm', '-g', 'root'], 'system process.argv was rewritten') + t.strictSame(process.argv, ['node', 'npm', 'root'], 'system process.argv was rewritten') t.strictSame(logs.verbose.byTitle('cli'), ['cli node npm']) t.strictSame(logs.verbose.byTitle('title'), ['title npm root']) - t.match(logs.verbose.byTitle('argv'), ['argv "--global" "root"']) + t.match(logs.verbose.byTitle('argv'), ['argv "root"']) t.strictSame(logs.info, [`using npm@${Npm.version}`, `using node@${process.version}`]) t.equal(outputs.length, 1) t.match(outputs[0], dirname(process.cwd()))