2
votes

I am trying to publish npm module on one of my jenkins slaves that is windows server. The details of the machine are:

  • OS version: Windows Server 2008 R2 Enterprise
  • npm version: 5.7.1
  • node_js version: 8.10.0

The command I am running is:

npm publish --registry https://artifactory/artifactory/api/npm/npm-internal

After I run the command, I get the following error:

npm ERR! publish Failed PUT 403
npm ERR! path C:\Windows\TEMP\17\npm-13996-ae750e79\tmp\fromDir-6b5530ec\package.tgz
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Windows\TEMP\17\npm-13996-ae750e79\tmp\fromDir-6b5530ec\package.tgz'
npm ERR!  { Error: EPERM: operation not permitted, unlink 'C:\Windows\TEMP\17\npm-13996-ae750e79\tmp\fromDir-6b5530ec\package.tgz'
npm ERR!   cause:
npm ERR!    { Error: EPERM: operation not permitted, unlink 'C:\Windows\TEMP\17\npm-13996-ae750e79\tmp\fromDir-6b5530ec\package.tgz'
npm ERR!      errno: -4048,
npm ERR!      code: 'EPERM',
npm ERR!      syscall: 'unlink',
npm ERR!      path: 'C:\\Windows\\TEMP\\17\\npm-13996-ae750e79\\tmp\\fromDir-6b5530ec\\package.tgz' },
npm ERR!   isOperational: true,
npm ERR!   stack: 'Error: EPERM: operation not permitted, unlink \'C:\\Windows\\TEMP\\17\\npm-13996-ae750e79\\tmp\\fromDir-6b5530ec\\package.tgz\'',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path: 'C:\\Windows\\TEMP\\17\\npm-13996-ae750e79\\tmp\\fromDir-6b5530ec\\package.tgz' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Roaming\npm-cache\_logs\2018-04-16T08_22_53_980Z-debug.log

I checked with the command npm whoami who is the user that logged in, and it has the full permissions to deploy the package to the artifactory server. Also, The publish command is working on other identical jenkins slave that is windows server, but with npm version 3.10.10. Therefore, I tried to downgrade the npm version in the problematic jenkins slave to 3.10.10 , and the publish ran successfully.

I tried to clean the cache of npm, to uninstall and install the nodejs and npm, but nothing helped. I can't find a reason why in npm 3.10.10 it works, and in npm 5.7.1 it doesn't work.

Someone has any idea what I can do?

Thanks!

1

1 Answers

0
votes

Add .npmrc file in "C:\Users\user" location with jfrog artifactory authentication details in it.

Sample auth details

registry=<repository url>
_auth=<authentication token from artifactory>
email=<emailid>
always-auth = true