错误原因
1. 文件或目录被其他程序占用
2. 账号(操作系统)没有权限
3. npm未登录
解决方案
3.1. 无npm账号使用 npm adduser 或到官方网站注册账号.
3.2. 有npm账号直接使用命令 npm login 登录.
注意: 只提供了第3种错误解决方案, 其余两种网上讨论较多.
npm ERR! path C:\Users\john\AppData\Local\Temp\npm-812-8bb4f5c6\tmp\fromDir-8870
88eb\package.tgz
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\john\AppData\Lo
cal\Temp\npm-812-8bb4f5c6\tmp\fromDir-887088eb\package.tgz'
npm ERR! { Error: EPERM: operation not permitted, unlink 'C:\Users\john\AppData
\Local\Temp\npm-812-8bb4f5c6\tmp\fromDir-887088eb\package.tgz'
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, unlink 'C:\Users\john\AppDa
ta\Local\Temp\npm-812-8bb4f5c6\tmp\fromDir-887088eb\package.tgz'
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\Users\\john\\AppData\\Local\\Temp\\npm-812-8bb4f5c6\\tm
p\\fromDir-887088eb\\package.tgz' },
npm ERR! isOperational: true,
npm ERR! stack: 'Error: EPERM: operation not permitted, unlink \'C:\\Users\\jo
hn\\AppData\\Local\\Temp\\npm-812-8bb4f5c6\\tmp\\fromDir-887088eb\\package.tgz\'
',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\Users\\john\\AppData\\Local\\Temp\\npm-812-8bb4f5c6\\tmp\\
fromDir-887088eb\\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 ant
ivirus),
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 t
he
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\john\AppData\Roaming\npm-cache\_logs\2020-02-28T02_45_32_3
32Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 4294963248
npm ERR! my-ui@2.0.18 publish:patch: `npm run package && gulp version-patch &
& npm publish`
npm ERR! Exit status 4294963248
npm ERR!
npm ERR! Failed at the my-ui@2.0.18 publish:patch script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\john\AppData\Roaming\npm-cache\_logs\2020-02-28T02_45_32_6
41Z-debug.log
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。