Skip to content

[BUG] Run Scripts and Lifecycle Scripts Broken on IBM i #6025

@DavidRusso

Description

@DavidRusso

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

This issue applies to certain versions of NPM supplied by IBM in the yum repos for the IBM i operating system. This issue does NOT seem to affect the same versions of NPM on other platforms.

Affected NPM versions:

  • NPM 8.9.2 which is included with Node.js 16.18.1 for IBM i.
  • NPM 8.9.2 which is included with Node.js 18.12.1 for IBM i.

Even though the NPM version number is the same, the behavior is different in the 2 scenarios mentioned above.

In affected versions of NPM, lifecycle and run scripts are entirely broken. This prevents many packages from installing properly.

Take for example this simplistic package (create files in a directory named 'test'):

File test/package.json:

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "install": "node install.js",
    "do_something": "node do_something.js"
  },
  "author": "",
  "license": "ISC"
}

File test/install.js:

console.log("install.js script ran successfully!");

File test/do_something.js:

console.log("do_something.js script ran successfully!");
  • With the copy of NPM 8.9.2 shipped with Node.js 16.18.1, running npm install from inside the 'test' directory fails with this output:
> [email protected] install
> node install.js

node install.js: --:  not found
npm ERR! code 127
npm ERR! path /home/drusso/test
npm ERR! command failed
npm ERR! command sh -c -- node install.js
  • With the copy of NPM 8.9.2 shipped with Node.js 16.18.1, running npm run do_something from inside the 'test' directory fails with this output:
> [email protected] do_something
> node do_something.js

node do_something.js: --:  not found
  • With the copy of NPM 8.9.2 shipped with Node.js 18.12.1, running the 2 commands mentioned above from within the 'test' directory works properly. However, if you change to the parent directory of 'test' and run npm run --prefix test do_something, it fails with this output:
> [email protected] do_something
> node do_something.js

node do_something.js: --:  not found

These problems suddenly cropped up with the recent updates to the nodejs16 and nodejs18 packages in the IBM i yum repos. For example, NPM 8.5.0 shipped with Node.js 16.14.2 is NOT affected. Also, NPM 8.6.0 shipped with Node.js 18.0.0 is NOT affected.

Expected Behavior

The lifecycle and run scripts should execute without error.

Steps To Reproduce

See above.

Environment

  • npm: 8.9.2
  • Node.js: 16.18.1
  • OS Name: IBM i 7.3, 7.4, and 7.5
  • System Model Name: n/a, multiple models
  • npm config:
; node bin location = /QOpenSys/pkgs/lib/nodejs16/bin/node
; node version = v16.18.1
; npm local prefix = /home/drusso
; npm version = 8.19.2
; cwd = /home/drusso
; HOME = /home/DRUSSO
; Run `npm config ls -l` to show all defaults.
  • npm: 8.9.2
  • Node.js: 18.12.1
  • OS Name: IBM i 7.3, 7.4, and 7.5
  • System Model Name: n/a, multiple models
  • npm config:
; "global" config from /QOpenSys/pkgs/lib/nodejs18/etc/npmrc

script-shell = "/QOpenSys/pkgs/bin/bash"
tarball = "/QOpenSys/pkgs/lib/nodejs18/node-headers.tar.gz"

; node bin location = /QOpenSys/pkgs/lib/nodejs18/bin/node
; node version = v18.12.1
; npm local prefix = /home/drusso
; npm version = 8.19.2
; cwd = /home/drusso
; HOME = /home/DRUSSO
; Run `npm config ls -l` to show all defaults.

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions