npm publish broken for all windows users


(Darrell) #1

What I Wanted to Do

Trying to publish an npm package to npmjs using npm publish
More evidence of this problem:

What Happened Instead

When running npm publish on Windows 10, I get the following output:

npm notice
npm notice package: netpack-typescript-compiler@0.0.7
npm notice === Tarball Contents ===
npm notice 516B package.json
npm notice 337B jsconfig.json
npm notice 31.2kB netpack-typescript-compiler-0.0.7.tgz
npm notice 467B
npm notice 10B typings.json
npm notice 7.2kB dist/compilerhost.js
npm notice 6.1kB dist/
npm notice 2.9kB dist/test/compiler.test.js
npm notice 2.2kB dist/test/
npm notice 8.3kB src/compilerhost.ts
npm notice 2.9kB src/test/compiler.test.ts
npm notice 354B src/tsconfig.json
npm notice 226B testFiles/moduleA/classa.ts
npm notice 382B testFiles/moduleB/classb.ts
npm notice 236B testFiles/tsconfig.json
npm notice 6.9kB typings/globals/mocha/index.d.ts
npm notice 384B typings/globals/mocha/typings.json
npm notice 112.7kB typings/globals/node/index.d.ts
npm notice 379B typings/globals/node/typings.json
npm notice 151B typings/index.d.ts
npm notice 17.2kB typings/modules/chai/index.d.ts
npm notice 743B typings/modules/chai/typings.json
npm notice 2.7kB typings/modules/memory-fs/index.d.ts
npm notice 396B typings/modules/memory-fs/typings.json
npm notice === Tarball Details ===
npm notice name: netpack-typescript-compiler
npm notice version: 0.0.7
npm notice package size: 63.1 kB
npm notice unpacked size: 204.8 kB
npm notice shasum: b47724fca0f55e29aaf484e2ffb5063c694e37a7
npm notice integrity: sha512-FzQw9x7BUk2DC[…]rwmpqxj+7IpSg==
npm notice total files: 24
npm notice
npm ERR! path C:\Users\ADMINI~1\AppData\Local\Temp\npm-7604-ceeed59e\tmp\fromDir-cf9ad64a\package.tgz
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink ‘C:\Users\ADMINI~1\AppData\Local\Temp\npm-7604-ceeed59e\tmp\fromDir-cf9ad64a\package.tgz’
npm ERR! { Error: EPERM: operation not permitted, unlink ‘C:\Users\ADMINI~1\AppData\Local\Temp\npm-7604-ceeed59e\tmp\fromDir-cf9ad64a\package.tgz’
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, unlink ‘C:\Users\ADMINI~1\AppData\Local\Temp\npm-7604-ceeed59e\tmp\fromDir-cf9ad64a\package.tgz’
npm ERR! errno: -4048,
npm ERR! code: ‘EPERM’,
npm ERR! syscall: ‘unlink’,
npm ERR! path: ‘C:\Users\ADMINI~1\AppData\Local\Temp\npm-7604-ceeed59e\tmp\fromDir-cf9ad64a\package.tgz’ },
npm ERR! isOperational: true,
npm ERR! stack: ‘Error: EPERM: operation not permitted, unlink ‘C:\Users\ADMINI~1\AppData\Local\Temp\npm-7604-ceeed59e\tmp\fromDir-cf9ad64a\package.tgz’’,
npm ERR! errno: -4048,
npm ERR! code: ‘EPERM’,
npm ERR! syscall: ‘unlink’,
npm ERR! path: ‘C:\Users\ADMINI~1\AppData\Local\Temp\npm-7604-ceeed59e\tmp\fromDir-cf9ad64a\package.tgz’ }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It’s possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache_logs\2018-09-30T11_29_08_311Z-debug.log

Reproduction Steps

  1. Install nodejs version v8.12.0 on Windows 10.
  2. git clone
  3. CD into the root folder, and from a command prompt run npm publish

Note: I get the same error when running the command prompt as “Administrator”


I have successfully published a version of this package before, a long time ago now though:

Platform Info

$ npm --versions
{ 'netpack-typescript-compiler': '0.0.7',
  npm: '6.4.1',
  ares: '1.10.1-DEV',
  cldr: '32.0',
  http_parser: '2.8.0',
  icu: '60.1',
  modules: '57',
  napi: '3',
  nghttp2: '1.32.0',
  node: '8.12.0',
  openssl: '1.0.2p',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.19.2',
  v8: '6.2.414.66',
  zlib: '1.2.11' }
$ node -p process.platform

(Ben Gubler) #2

I have the exact same problem! Scanning through GitHub, people suggested running npm adduser or npm login: neither of them fixed it.

The error only shows up for me when I use 2FA.

Example: $ npm publish --opt=123456 produces an error,

but when I disable 2FA it works.

I ended up just disabling having 2FA required to publish.

(Kat Marchán) #3

This looks like a race or access bug when clearing out the tmpdir. Most likely, the tarball fd isn’t being closed on time.

I have a vague feeling we got a fix for this at some point with a recent refactor from a contributor, but I don’t remember what it was.

Thanks for the bug report!