if package.json has prepare npm script, rtNpm.publish step will try to run npm pack and the prepare script. Since rtNpm.publish does not have option to pass args, we are not able to fix this problem. We can pass extra args --ignore-scripts
it looks like --ignore-scripts is also not ignoring the prepare scripts. Any help would be appreciated.
Error:
16:14:00 May 01, 2024 10:44:00 AM org.jfrog.build.extractor.packageManager.PackageManagerLogger error
16:14:00 SEVERE: ./> web-ui@2.6.1-SNAPSHOT prepare
16:14:00 > echo 'nothing'
16:14:00
16:14:00 nothing
16:14:00 web-ui-2.6.1-SNAPSHOT.tgz (No such file or directory)
16:14:00 java.io.FileNotFoundException: ./> web-ui@2.6.1-SNAPSHOT prepare
16:14:00 > echo 'nothing'
16:14:00
16:14:00 nothing
16:14:00 web-ui-2.6.1-SNAPSHOT.tgz (No such file or directory)
16:14:00 at java.base/java.io.FileInputStream.open0(Native Method)
16:14:00 at java.base/java.io.FileInputStream.open(FileInputStream.java:216)
16:14:00 at java.base/java.io.FileInputStream.(FileInputStream.java:157)
16:14:00 at org.jfrog.build.extractor.npm.extractor.NpmPublish.readPackageInfoFromTarball(NpmPublish.java:119)
16:14:00 at org.jfrog.build.extractor.npm.extractor.NpmPublish.deploy(NpmPublish.java:139)
16:14:00 at org.jfrog.build.extractor.npm.extractor.NpmPublish.execute(NpmPublish.java:93)
16:14:00 at org.jfrog.build.extractor.packageManager.PackageManagerExtractor.executeAndSaveBuildInfo(PackageManagerExtractor.java:33)
16:14:00 at org.jfrog.build.extractor.npm.extractor.NpmPublish.main(NpmPublish.java:78)
To Reproduce
Add prepare script to package.json
"prepare": "echo 'nothing'"
run rtNpm.publish step in Jenkins
Expected behavior
Success pack and publish to artifactory
Screenshots
If applicable, add screenshots to help explain your problem.
Versions
Jenkins Artifactory plugin version: 4.0.6
Jenkins operating system: 2.375.3
Artifactory Version: 7.41.12
Additional context
Add any other context about the problem here.
Describe the bug After upgrading the nodejs v20.12.0 and npm 10.5.0, the npm pack and publish step has default foreground-scripts to true. Reference - https://docs.npmjs.com/cli/v10/using-npm/changelog#1050-2024-02-28. (818957c #7158 pack, publish: default foreground-scripts to true (#7158) (@ljharb))
if package.json has
prepare
npm script, rtNpm.publish step will try to run npm pack and the prepare script. Since rtNpm.publish does not have option to pass args, we are not able to fix this problem. We can pass extra args--ignore-scripts
def buildInfo = rtNpm.publish path: 'npm-example', args: '--ignore-scripts'
it looks like --ignore-scripts is also not ignoring the prepare scripts. Any help would be appreciated.
Error: 16:14:00 May 01, 2024 10:44:00 AM org.jfrog.build.extractor.packageManager.PackageManagerLogger error 16:14:00 SEVERE: ./> web-ui@2.6.1-SNAPSHOT prepare 16:14:00 > echo 'nothing' 16:14:00(FileInputStream.java:157)
16:14:00 at org.jfrog.build.extractor.npm.extractor.NpmPublish.readPackageInfoFromTarball(NpmPublish.java:119)
16:14:00 at org.jfrog.build.extractor.npm.extractor.NpmPublish.deploy(NpmPublish.java:139)
16:14:00 at org.jfrog.build.extractor.npm.extractor.NpmPublish.execute(NpmPublish.java:93)
16:14:00 at org.jfrog.build.extractor.packageManager.PackageManagerExtractor.executeAndSaveBuildInfo(PackageManagerExtractor.java:33)
16:14:00 at org.jfrog.build.extractor.npm.extractor.NpmPublish.main(NpmPublish.java:78)
16:14:00 nothing 16:14:00 web-ui-2.6.1-SNAPSHOT.tgz (No such file or directory) 16:14:00 java.io.FileNotFoundException: ./> web-ui@2.6.1-SNAPSHOT prepare 16:14:00 > echo 'nothing' 16:14:00
16:14:00 nothing 16:14:00 web-ui-2.6.1-SNAPSHOT.tgz (No such file or directory) 16:14:00 at java.base/java.io.FileInputStream.open0(Native Method) 16:14:00 at java.base/java.io.FileInputStream.open(FileInputStream.java:216) 16:14:00 at java.base/java.io.FileInputStream.
To Reproduce
Expected behavior Success pack and publish to artifactory
Screenshots If applicable, add screenshots to help explain your problem.
Versions
Additional context Add any other context about the problem here.