安装webpack时出现的错误之一解决办法

E:Program Files>npm install webpack@3.6.0 -g
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm ERR! path C:UsersHPAppDataRoaming
pm
ode_moduleswebpack
ode_modules\_fsevents@1.2.9@fsevents
ode_modulesstring-width
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename C:UsersHPAppDataRoaming
pm
ode_moduleswebpack
ode_modules\_fsevents@1.2.9@fsevents
ode_modulesstring-width -> C:UsersHPAppDataRoaming
pm
ode_moduleswebpack
ode_modulesyargs
ode_modulescliui
ode_modulesstring-width
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:UsersHPAppDataRoaming
pm-cache\_logs2020-06-29T02_32_13_692Z-debug.log

最后的解决办法: 删除C:UsersHPAppDataRoaming pm ode_moduleswebpack ode_modules这个文件夹,再次npm install webpack@3.6.0 -g就可以了

经验分享 程序员 微信小程序 职场和发展