当我尝试运行 Remix 应用程序时,出现以下错误。此错误来自 remix 开发工具。我检查了错误中指定的两个文件路径,它们都存在并且应该可以工作。
Cannot find package '<project path>\node_modules\.pnpm\[email protected]_@[email protected][email protected][email protected]__react@18_jowj2r5lamytlrfivyqi2kheeq\node_modules\react-diff-viewer-continued\package.json' imported from <project path>\node_modules\.pnpm\[email protected]_@[email protected][email protected][email protected]__react@18_jowj2r5lamytlrfivyqi2kheeq\node_modules\remix-development-tools\dist\client.js
Did you mean to import "react-diff-viewer-continued/lib/src/index.js"?
我尝试卸载并重新安装
node_modules
和pnpm-lock.yaml
。我已将 auto-install-peers
中的 true
设置为 .npmrc
并运行 pnpm config set auto-install-peers true
。
从存储库中提取一些软件包更新后突然发生此错误。这仅发生在我的计算机上,参与该项目的所有其他人均不受影响。我尝试恢复到项目的旧版本,但仍然遇到相同的错误。
我使用 VS Code 和 pnpm 作为我的主要包管理器。我也是 Windows 系统。
我的问题是路径太长。
通过向 .npmrc 文件添加以下内容来修复
virtual-store-dir-max-length=80