2

Whenever I am running lerna bootstrap --hoist or lerna bootstrap I am getting the following error on my windows machine.

I have already tried npm login and force cleaned the npm cache but nothing seems to be working.

npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'E:\Devfolio_work\ethglobal-devfolio\node_modules\.staging\typescript-ebd093cf\lib\typescriptServices.js'
npm ERR!  { [Error: EPERM: operation not permitted, unlink 'E:\Devfolio_work\ethglobal-devfolio\node_modules\.staging\typescript-ebd093cf\lib\typescriptServices.js']
npm ERR!   cause:
npm ERR!    { Error: EPERM: operation not permitted, unlink 'E:\Devfolio_work\ethglobal-devfolio\node_modules\.staging\typescript-ebd093cf\lib\typescriptServices.js'
npm ERR!      errno: -4048,
npm ERR!      code: 'EPERM',
npm ERR!      syscall: 'unlink',
npm ERR!      path:
npm ERR!       'E:\\Devfolio_work\\ethglobal-devfolio\\node_modules\\.staging\\typescript-ebd093cf\\lib\\typescriptServices.js' },
npm ERR!   stack:
npm ERR!    'Error: EPERM: operation not permitted, unlink \'E:\\Devfolio_work\\ethglobal-devfolio\\node_modules\\.staging\\typescript-ebd093cf\\lib\\typescriptServices.js\'',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path:
npm ERR!    'E:\\Devfolio_work\\ethglobal-devfolio\\node_modules\\.staging\\typescript-ebd093cf\\lib\\typescriptServices.js',
npm ERR!   parent: 'root' }
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\hp\AppData\Roaming\npm-cache\_logs\2019-01-09T16_55_24_342Z-debug.log

lerna.json

{
  "packages": [
    "packages/*"
  ],
  "version": "independent"
}

My Environment

lerna --version 3.5.1

npm --version 6.4.1

node --version 10.5.0

OS Version

Windows 10 1709

Prateek Surana
  • 672
  • 9
  • 29

2 Answers2

1

I finally found a solution; it seems to be an issue with Windows. Just run the command in an admin command prompt in your current working directory and it would work.

Jack Deeth
  • 3,062
  • 3
  • 24
  • 39
Prateek Surana
  • 672
  • 9
  • 29
0

This might have something to do with local vs. global installation of lerna. For me it helps to run lerna bootstrap, wait for the EPERM error, close the terminal and run lerna bootstrap again.

Another thing that might work is to run lerna clean.

Also watch out for any running scripts - that can lock up some dependencies making you unable to remove them without admin rights. Especially watch scripts.

I'm on Windows using git bash.

Andy
  • 380
  • 3
  • 16