npm publish permission error

What I Wanted to Do
Publish my npm package (npm publish)

What happened Instead
EPERM Error, npm tries unlink package.tgz from temp folder, but somehow npm can’t do it because of EPERM, i tried to publish using Run as administrator but still giving me EPERM Error

Details
Error log here:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\Node.JS\\node.exe',
1 verbose cli   'C:\\Program Files\\Node.JS\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'publish',
1 verbose cli   'dbdapi.js' ]
2 info using npm@6.4.1
3 info using node@v10.15.0
4 verbose npm-session 3df1bc6cb359c2b4
5 verbose publish [ 'dbdapi.js' ]
6 info lifecycle dbdapi.js@0.7.9-pre~prepublish: dbdapi.js@0.7.9-pre
7 info lifecycle dbdapi.js@0.7.9-pre~prepare: dbdapi.js@0.7.9-pre
8 info lifecycle dbdapi.js@0.7.9-pre~prepublishOnly: dbdapi.js@0.7.9-pre
9 info lifecycle dbdapi.js@0.7.9-pre~prepack: dbdapi.js@0.7.9-pre
10 info lifecycle dbdapi.js@0.7.9-pre~postpack: dbdapi.js@0.7.9-pre
11 notice
12 notice package: dbdapi.js@0.7.9-pre
13 notice === Tarball Contents ===
14 notice 764B  package.json
14 notice 26B   .coveralls.yml
14 notice 299B  .eslintrc.json
14 notice 120B  .travis.yml
14 notice 39B   index.js
14 notice 1.1kB LICENSE
14 notice 2.3kB README.md
14 notice 710B  .circleci/config.yml
14 notice 5.6kB src/DBDRequest.js
14 notice 9.5kB src/DiscordBotsDev.js
14 notice 45B   src/main.js
15 notice === Tarball Details ===
16 notice name:          dbdapi.js
16 notice version:       0.7.9-pre
16 notice package size:  5.4 kB
16 notice unpacked size: 20.4 kB
16 notice shasum:        cc850338f3ba392786efebca23e07dfd6602e2c2
16 notice integrity:     sha512-Erb4ZsjUzOKFh[...]tW6Uw5F5xEMPg==
16 notice total files:   11
17 notice
18 verbose getPublishConfig undefined
19 silly mapToRegistry name dbdapi.js
20 silly mapToRegistry using default registry
21 silly mapToRegistry registry https://registry.npmjs.org/
22 silly mapToRegistry data { type: 'tag',
22 silly mapToRegistry   registry: true,
22 silly mapToRegistry   where: undefined,
22 silly mapToRegistry   raw: 'dbdapi.js',
22 silly mapToRegistry   name: 'dbdapi.js',
22 silly mapToRegistry   escapedName: 'dbdapi.js',
22 silly mapToRegistry   scope: undefined,
22 silly mapToRegistry   rawSpec: '',
22 silly mapToRegistry   saveSpec: null,
22 silly mapToRegistry   fetchSpec: 'latest',
22 silly mapToRegistry   gitRange: undefined,
22 silly mapToRegistry   gitCommittish: undefined,
22 silly mapToRegistry   hosted: undefined }
23 silly mapToRegistry uri https://registry.npmjs.org/dbdapi.js
24 verbose publish registryBase https://registry.npmjs.org/
25 silly publish uploading C:\Users\Hazmi35\AppData\Local\Temp\npm-3304-73bb6fa8\tmp\fromDir-c15e891d\package.tgz
26 verbose stack Error: EPERM: operation not permitted, unlink 'C:\Users\Hazmi35\AppData\Local\Temp\npm-3304-73bb6fa8\tmp\fromDir-c15e891d\package.tgz'
27 verbose cwd D:\Coding
28 verbose Windows_NT 10.0.18312
29 verbose argv "C:\\Program Files\\Node.JS\\node.exe" "C:\\Program Files\\Node.JS\\node_modules\\npm\\bin\\npm-cli.js" "publish" "dbdapi.js"
30 verbose node v10.15.0
31 verbose npm  v6.4.1
32 error path C:\Users\Hazmi35\AppData\Local\Temp\npm-3304-73bb6fa8\tmp\fromDir-c15e891d\package.tgz
33 error code EPERM
34 error errno -4048
35 error syscall unlink
36 error Error: EPERM: operation not permitted, unlink 'C:\Users\Hazmi35\AppData\Local\Temp\npm-3304-73bb6fa8\tmp\fromDir-c15e891d\package.tgz'
36 error  { [Error: EPERM: operation not permitted, unlink 'C:\Users\Hazmi35\AppData\Local\Temp\npm-3304-73bb6fa8\tmp\fromDir-c15e891d\package.tgz']
36 error   cause:
36 error    { Error: EPERM: operation not permitted, unlink 'C:\Users\Hazmi35\AppData\Local\Temp\npm-3304-73bb6fa8\tmp\fromDir-c15e891d\package.tgz'
36 error      errno: -4048,
36 error      code: 'EPERM',
36 error      syscall: 'unlink',
36 error      path:
36 error       'C:\\Users\\Hazmi35\\AppData\\Local\\Temp\\npm-3304-73bb6fa8\\tmp\\fromDir-c15e891d\\package.tgz' },
36 error   isOperational: true,
36 error   stack:
36 error    'Error: EPERM: operation not permitted, unlink \'C:\\Users\\Hazmi35\\AppData\\Local\\Temp\\npm-3304-73bb6fa8\\tmp\\fromDir-c15e891d\\package.tgz\'',
36 error   errno: -4048,
36 error   code: 'EPERM',
36 error   syscall: 'unlink',
36 error   path:
36 error    'C:\\Users\\Hazmi35\\AppData\\Local\\Temp\\npm-3304-73bb6fa8\\tmp\\fromDir-c15e891d\\package.tgz' }
37 error The operation was rejected by your operating system.
37 error It's possible that the file was already in use (by a text editor or antivirus),
37 error or that you lack permissions to access it.
37 error
37 error If you believe this might be a permissions issue, please double-check the
37 error permissions of the file and its containing directories, or try running
37 error the command again as root/Administrator (though this is not recommended).
38 verbose exit [ -4048, true ]

Platform Info

$ npm --versions
{ npm: '6.4.1',
  ares: '1.15.0',
  cldr: '33.1',
  http_parser: '2.8.0',
  icu: '62.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.34.0',
  node: '10.15.0',
  openssl: '1.1.0j',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.2',
  v8: '6.8.275.32-node.45',
  zlib: '1.2.11' }

$ node -p  process.platform
win32

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.