问题描述
从网上下载的代码想运行一下,在npm run serve
时却报错,Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No “exports” main defined in xxx\node_modules@babel\helper-compilation-targets\package.json
产生原因
可能是node版本导致引入依赖时bable配置问题。
解决办法
第一步:找到该文件:\node_modules@babel\helper-compilation-targets\package.json
第二步:找到第48行的代码,把“exports”:false改成如下
"exports": {
".": "./lib/index.js"
},