在执行yarn build
打包node项目时,出现以下错误:
[vite]: Rollup failed to resolve import "date-fns/_lib/cloneObject/index.js" from "node_modules/date-fns-tz/esm/formatInTimeZone/index.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
error during build:
Error: [vite]: Rollup failed to resolve import "date-fns/_lib/cloneObject/index.js" from "node_modules/date-fns-tz/esm/formatInTimeZone/index.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
原因是本地缓存不完整或出现错误,无法找到对应的依赖文件,打开该文件后,发现文件内容只有正常文件的一部分,怀疑是使用的npm镜像没有完整文件内容。可通过运行以下命令重建本地缓存,重新尝试打包即可成功:
yarn cache clean
发表回复