操作不允许错误 npm while 运行 lerna bootstrap -- windows 上的提升命令
operation not permitted error npm while running lerna bootstrap -- hoist command on windows
每当我 运行 lerna bootstrap --hoist
或 lerna bootstrap
我的 windows 机器上出现以下错误。
我已经尝试 npm login
并强制清理了 npm 缓存,但似乎没有任何效果。
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\_logs19-01-09T16_55_24_342Z-debug.log
lerna.json
{
"packages": [
"packages/*"
],
"version": "independent"
}
我的环境
lerna --version
3.5.1
npm --version
6.4.1
node --version
10.5.0
OS版本
Windows 10 1709
我终于找到了解决办法;这似乎是 Windows 的问题。只需 运行 您当前工作目录中管理员命令提示符中的命令即可。
这可能与 lerna 的本地安装与全局安装有关。
对我来说,它有助于 运行 lerna bootstrap
,等待 EPERM
错误,关闭终端并再次 运行 lerna bootstrap
。
另一个可能有用的方法是 运行 lerna clean
.
还要注意任何 运行ning 脚本 - 可能会锁定某些依赖项,使您在没有管理员权限的情况下无法删除它们。尤其是看剧本。
我在 Windows 使用 git bash。
每当我 运行 lerna bootstrap --hoist
或 lerna bootstrap
我的 windows 机器上出现以下错误。
我已经尝试 npm login
并强制清理了 npm 缓存,但似乎没有任何效果。
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\_logs19-01-09T16_55_24_342Z-debug.log
lerna.json
{
"packages": [
"packages/*"
],
"version": "independent"
}
我的环境
lerna --version
3.5.1
npm --version
6.4.1
node --version
10.5.0
OS版本
Windows 10 1709
我终于找到了解决办法;这似乎是 Windows 的问题。只需 运行 您当前工作目录中管理员命令提示符中的命令即可。
这可能与 lerna 的本地安装与全局安装有关。
对我来说,它有助于 运行 lerna bootstrap
,等待 EPERM
错误,关闭终端并再次 运行 lerna bootstrap
。
另一个可能有用的方法是 运行 lerna clean
.
还要注意任何 运行ning 脚本 - 可能会锁定某些依赖项,使您在没有管理员权限的情况下无法删除它们。尤其是看剧本。
我在 Windows 使用 git bash。