解决报错:TypeError:compilation.getPathWithInfo is not a function

1,122 阅读1分钟

报错:

        最近在运行前端的时候出现一个错误,只要改动vue和js文件,一保存就会退出运行,出现TypeError:compilation.getPathWithInfo is not a function的错误,并且重新clone项目也还是一样。

解决方法:

        原因出在nodejs的版本问题,我当时的nodejs是14.17.4,而我完全卸载nodejs后重新安装了nodejs 14.17.1,重新安装配置了环境变量,问题就解决了

注意:

在卸载nodejs并重新下载另外版本的nodejs时,刚安装好后可能会出现npm报错,即Error:EPERM: operation not permitted, mkdir'C:\Program Files\nodejs',此时需要删除C:\用户\user目录下的.npmrc文件即可