<w> [webpack.cache.PackFileCacheStrategy] 包缓存失败:错误:无法快照解析依赖项

Chu*_*ngz 12 caching node.js reactjs webpack

尝试在我的 VPS 上运行一个项目,但我不断收到此错误标记。我已尝试清除并安装所有新内容,但问题仍然出现。任何帮助将不胜感激。

<t> [webpack.cache.PackFileCacheStrategy] restore cache container: 64.298367 ms
info  - Creating an optimized production build ...    [webpack.cache.PackFileCacheStrategy] Pack got invalid because of write to: Compilation/modules|/home/admin/web/server/public_html/node_modules/next/dist/build/webpack/loaders/next-swc-loader.js??ruleSet[1].rules[2].oneOf[2].use!/home/admin/web/server/public_html/node_modules/next/dist/pages/_error.js
    [webpack.cache.PackFileCacheStrategy] Storing pack...
    [webpack.cache.PackFileCacheStrategy] Capturing build dependencies... (/home/admin/web/server/public_html/next.config.js, /home/admin/web/server/public_html/node_modules/next/dist/compiled/, /home/admin/web/server/public_html/node_modules/next/dist/build/webpack/loaders/next-swc-loader.js)
info  - Creating an optimized production build .<t> [webpack.cache.PackFileCacheStrategy] resolve build dependencies: 90.189044 ms
    [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Error snapshotting file timestamp hash combination of /home/admin: Error: EACCES: permission denied, open '/home/admin'
<t> [webpack.cache.PackFileCacheStrategy] snapshot build dependencies: 1.801434 ms
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Unable to snapshot resolve dependencies
    [webpack.cache.PackFileCacheStrategy] Error: Unable to snapshot resolve dependencies
        at /home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:70754:13
        at jobError (/home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:47008:5)
        at /home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:47071:10
        at /home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:47968:13
        at /home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:131419:5
        at Hook.eval [as callAsync] (eval at create (/home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:23493:10), <anonymous>:6:1)
        at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:23295:14)
        at AsyncQueue._handleResult (/home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:131389:21)
        at /home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:131372:11
        at ReadFileContext.<anonymous> (/home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:47917:12)
    [webpack.cache.PackFileCacheStrategy] No pack exists at /home/admin/web/server/public_html/.next/cache/webpack/edge-server-production.pack: Error: ENOENT: no such file or directory, stat '/home/admin/web/server/public_html/.next/cache/webpack/edge-server-production/index.pack'
<t> [webpack.cache.PackFileCacheStrategy] restore cache container: 19.478739 ms
    [webpack.cache.PackFileCacheStrategy] No pack exists at /home/admin/web/server/public_html/.next/cache/webpack/client-production.pack: Error: ENOENT: no such file or directory, stat '/home/admin/web/server/public_html/.next/cache/webpack/client-production/index.pack'
<t> [webpack.cache.PackFileCacheStrategy] restore cache container: 9.156366 ms
info  - Creating an optimized production build ...    [webpack.cache.PackFileCacheStrategy] Pack got invalid because of write to: Compilation/modules|/home/admin/web/server/public_html/node_modules/next/dist/build/webpack/loaders/next-client-pages-loader.js?absolutePagePath=next%2Fdist%2Fpages%2F_app&page=%2F_app!
    [webpack.cache.PackFileCacheStrategy] Storing pack...
    [webpack.cache.PackFileCacheStrategy] Capturing build dependencies... (/home/admin/web/server/public_html/next.config.js, /home/admin/web/server/public_html/node_modules/next/dist/compiled/, /home/admin/web/server/public_html/node_modules/next/dist/build/webpack/loaders/next-client-pages-loader.js, /home/admin/web/server/public_html/node_modules/next/dist/build/webpack/loaders/next-swc-loader.js)
info  - Creating an optimized production build .<t> [webpack.cache.PackFileCacheStrategy] resolve build dependencies: 102.05922 ms
    [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Error snapshotting file timestamp hash combination of /home/admin: Error: EACCES: permission denied, open '/home/admin'
<t> [webpack.cache.PackFileCacheStrategy] snapshot build dependencies: 2.324734 ms
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Unable to snapshot resolve dependencies
    [webpack.cache.PackFileCacheStrategy] Error: Unable to snapshot resolve dependencies
        at /home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:70754:13
        at jobError (/home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:47008:5)
        at /home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:47071:10
        at /home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:47968:13
        at /home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:131419:5
        at Hook.eval [as callAsync] (eval at create (/home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:23493:10), <anonymous>:6:1)
        at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:23295:14)
        at AsyncQueue._handleResult (/home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:131389:21)
        at /home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:131372:11
        at ReadFileContext.<anonymous> (/home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:47917:12)```
Run Code Online (Sandbox Code Playgroud)

小智 41

解决方法是删除.next文件夹并yarn run dev再次运行。


M. *_*ack 2

正如本讨论中所述,您的情况的合适解决方案似乎是

\n
cd [your project]\nnpm install -g n\nsudo n stable\nrm -rf node_modules/\nrm -f package-lock.json\nnpm install\n
Run Code Online (Sandbox Code Playgroud)\n

我真的无法重现该错误,所以我不是 100% 确信这会起作用,但您可以尝试一下并让我们知道。\xc2\xb0\n我还认为您可以跳过安装稳定的节点版本,因此,如果您已经有一个,只需尝试干净的 npm 安装。

\n