Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Unable to snapshot resolve dependencies #27650

Closed
Fangston0 opened this issue Jul 31, 2021 · 7 comments
Labels
bug Issue was opened via the bug report template. Webpack Related to Webpack with Next.js.

Comments

@Fangston0
Copy link

What version of Next.js are you using?

11.0.1

What version of Node.js are you using?

14.17.3

What browser are you using?

Chrome

What operating system are you using?

Windows

How are you deploying your application?

Not deployed yet

Describe the Bug

Simply creating a new Next.js project and running yarn dev / npm run dev logs the following warning in the console:

[webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Unable to snapshot resolve dependencies

I have tried deleting yarn.lock, and running yarn install again , but that did not do anything.

I'm not sure if this is related but, when first creating the project, I also get the following warnings:

image

Expected Behavior

No warning, or an explanation of the warning.

To Reproduce

  1. yarn create next-app or npx create-next-app
  2. Finish the setup
  3. yarn dev or npm run start
@Fangston0 Fangston0 added the bug Issue was opened via the bug report template. label Jul 31, 2021
@sokra
Copy link
Member

sokra commented Aug 3, 2021

Some kind of error happened... You need to enable debug logging to see the error:

// next.config.js
module.exports = {
  webpack(config) {
    config.infrastructureLogging = { debug: /PackFileCache/ }
    return config;
  }
}

@Fangston0
Copy link
Author

Fangston0 commented Aug 3, 2021

Some kind of error happened... You need to enable debug logging to see the error:

// next.config.js
module.exports = {
  webpack(config) {
    config.infrastructureLogging = { debug: /PackFileCache/ }
    return config;
  }
}

Here's what I got on my console after enabling it:

PS E:\React Projects\testapp> yarn dev
yarn run v1.22.11
$ next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
[webpack.cache.PackFileCacheStrategy] No pack exists at E:\React Projects\testapp.next\cache\webpack\client-development.pack: Error: ENOENT: no such f
ile or directory, stat 'E:\React Projects\testapp.next\cache\webpack\client-development\index.pack'
[webpack.cache.PackFileCacheStrategy] restore cache container: 47.1833 ms
[webpack.cache.PackFileCacheStrategy] No pack exists at E:\React Projects\testapp.next\cache\webpack\server-development.pack: Error: ENOENT: no such f
ile or directory, stat 'E:\React Projects\testapp.next\cache\webpack\server-development\index.pack'
[webpack.cache.PackFileCacheStrategy] restore cache container: 44.0038 ms
[webpack.cache.PackFileCacheStrategy] Pack got invalid because of write to: ResolverCachePlugin|normal|dependencyType=|esm|path=|E:\React Projects\test
app|request=|E:\React Projects\testapp\node_modules@next\react-refresh-utils\runtime.js
[webpack.cache.PackFileCacheStrategy] Storing pack...
[webpack.cache.PackFileCacheStrategy] Capturing build dependencies... (E:\React Projects\testapp\next.config.js, E:\React Projects\testapp\node_modules
\next\dist\compiled, E:\React Projects\testapp\node_modules\next\dist\build\webpack\loaders\next-client-pages-loader.js, E:\React Projects\testapp\node_mo
dules@next\react-refresh-utils\loader.js, E:\React Projects\testapp\node_modules\next\dist\build\babel\loader\index.js, E:\React Projects\testapp\node_mod
ules\next\dist\build\webpack\loaders\next-style-loader\index.js, E:\React Projects\testapp\node_modules\next\dist\compiled\css-loader\cjs.js, E:\React Proj
ects\testapp\node_modules\next\dist\compiled\postcss-loader\cjs.js)
event - compiled successfully
[webpack.cache.PackFileCacheStrategy] Pack got invalid because of write to: ResolverCachePlugin|normal|dependencyType=|esm|path=|E:\React Projects\test
app|request=|private-next-pages/_app.js
[webpack.cache.PackFileCacheStrategy] Storing pack...
[webpack.cache.PackFileCacheStrategy] Capturing build dependencies... (E:\React Projects\testapp\next.config.js, E:\React Projects\testapp\node_modules
\next\dist\compiled, E:\React Projects\testapp\node_modules\next\dist\build\babel\loader\index.js, E:\React Projects\testapp\node_modules\next\dist\compil
ed\ignore-loader\index.js)
[webpack.cache.PackFileCacheStrategy] resolve build dependencies: 2174.4305 ms
[webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Error snapshotting file timestamp hash combination of E:\React Projects\testapp: Error: EI
NVAL: invalid argument, read
[webpack.cache.PackFileCacheStrategy] snapshot build dependencies: 10.1572 ms
[webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Unable to snapshot resolve dependencies
[webpack.cache.PackFileCacheStrategy] Error: Unable to snapshot resolve dependencies
at E:\React Projects\testapp\node_modules\next\dist\compiled\webpack\bundle5.js:77909:13
at jobError (E:\React Projects\testapp\node_modules\next\dist\compiled\webpack\bundle5.js:56110:5)
at E:\React Projects\testapp\node_modules\next\dist\compiled\webpack\bundle5.js:56161:10
at E:\React Projects\testapp\node_modules\next\dist\compiled\webpack\bundle5.js:56957:13
at E:\React Projects\testapp\node_modules\next\dist\compiled\webpack\bundle5.js:130615:5
at Hook.eval [as callAsync] (eval at create (E:\React Projects\testapp\node_modules\next\dist\compiled\webpack\bundle5.js:31934:10), :6:
1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (E:\React Projects\testapp\node_modules\next\dist\compiled\webpack\bundle5.js:31736:14)
at AsyncQueue._handleResult (E:\React Projects\testapp\node_modules\next\dist\compiled\webpack\bundle5.js:130585:21)
at E:\React Projects\testapp\node_modules\next\dist\compiled\webpack\bundle5.js:130568:11
at E:\React Projects\testapp\node_modules\next\dist\compiled\webpack\bundle5.js:56906:12
[webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Error snapshotting file timestamp hash combination of E:\React Projects: Error: EINVAL: in
valid argument, read
[webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Error snapshotting file timestamp hash combination of E:: Error: EINVAL: invalid argument
, read
[webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Error snapshotting file timestamp hash combination of E:\React Projects\testapp\node_modul
es@next: Error: EINVAL: invalid argument, read
[webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Error snapshotting file timestamp hash combination of E:\React Projects\testapp\node_modul
es: Error: EINVAL: invalid argument, read
[webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Error snapshotting file timestamp hash combination of E:\React Projects\testapp\node_modul
es@babel: Error: EINVAL: invalid argument, read
[webpack.cache.PackFileCacheStrategy] resolve build dependencies: 1628.2388 ms
[webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Error snapshotting file timestamp hash combination of E:\React Projects: Error: EINVAL: in
valid argument, read
[webpack.cache.PackFileCacheStrategy] snapshot build dependencies: 8.8026 ms
[webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Unable to snapshot resolve dependencies
[webpack.cache.PackFileCacheStrategy] Error: Unable to snapshot resolve dependencies
at E:\React Projects\testapp\node_modules\next\dist\compiled\webpack\bundle5.js:77909:13
at jobError (E:\React Projects\testapp\node_modules\next\dist\compiled\webpack\bundle5.js:56110:5)
at E:\React Projects\testapp\node_modules\next\dist\compiled\webpack\bundle5.js:56161:10
at E:\React Projects\testapp\node_modules\next\dist\compiled\webpack\bundle5.js:56957:13
at E:\React Projects\testapp\node_modules\next\dist\compiled\webpack\bundle5.js:130615:5
at Hook.eval [as callAsync] (eval at create (E:\React Projects\testapp\node_modules\next\dist\compiled\webpack\bundle5.js:31934:10), :6:
1)
at AsyncQueue._handleResult (E:\React Projects\testapp\node_modules\next\dist\compiled\webpack\bundle5.js:130585:21)
at E:\React Projects\testapp\node_modules\next\dist\compiled\webpack\bundle5.js:130568:11
at E:\React Projects\testapp\node_modules\next\dist\compiled\webpack\bundle5.js:56906:12
at E:\React Projects\testapp\node_modules\next\dist\compiled\webpack\bundle5.js:29533:16
[webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Error snapshotting file timestamp hash combination of E:\React Projects\testapp: Error: EI
NVAL: invalid argument, read
[webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Error snapshotting file timestamp hash combination of E:: Error: EINVAL: invalid argument
, read
[webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Error snapshotting file timestamp hash combination of E:\React Projects\testapp\node_modul
es: Error: EINVAL: invalid argument, read
[webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Error snapshotting file timestamp hash combination of E:\React Projects\testapp\node_modul
es@babel: Error: EINVAL: invalid argument, read

@Fangston0
Copy link
Author

Hi @sokra
Could you have a look at the above log and help me figure out what's wrong?
All I can understand is that some package is missing, but I am not sure how to fix that.
Any help would be appreciated, thank you!

@OmarOmeiri
Copy link

OmarOmeiri commented Nov 4, 2021

I have the same problem running a blank project created with npx create-next-app@latest --ts

versions:
node@16.2.0
next": "12.0.2
react": "17.0.2
react-dom: "17.0.2

How this is still unattended?

A simple blank project cannot be compiled with the following message:

info  - Checking validity of types  
info  - Creating an optimized production build ..    [webpack.cache.PackFileCacheStrategy] No pack exists 
at E:\Documents\CODE\WebDev\NextJs\vai\.next\cache\webpack\client-production.pack: Error: ENOENT: no such 
file or directory, stat 'E:\Documents\CODE\WebDev\NextJs\vai\.next\cache\webpack\client-production\index.pack'
<t> [webpack.cache.PackFileCacheStrategy] restore cache container: 23.72 ms
info  - Creating an optimized production build ..    [webpack.cache.PackFileCacheStrategy] Pack got invalid because of write to: Compilation/modules|E:\Documents\CODE\WebDev\NextJs\vai\node_modules\next\dist\build\webpack\loaders\next-client-pages-loader.js?page=%2F_app&absolutePagePath=private-next-pages%2F_app.tsx!    [webpack.cache.PackFileCacheStrategy] Storing pack...
    [webpack.cache.PackFileCacheStrategy] Capturing build dependencies... (E:\Documents\CODE\WebDev\NextJs\vai\next.config.js, E:\Documents\CODE\WebDev\NextJs\vai\node_modules\next\dist\compiled\, E:\Documents\CODE\WebDev\NextJs\vai\node_modules\next\dist\build\webpack\loaders\next-client-pages-loader.js, E:\Documents\CODE\WebDev\NextJs\vai\node_modules\next\dist\build\webpack\loaders\next-swc-loader.js, E:\Documents\CODE\WebDev\NextJs\vai\node_modules\next\dist\build\webpack\loaders\css-loader\src\index.js, E:\Documents\CODE\WebDev\NextJs\vai\node_modules\next\dist\build\webpack\loaders\postcss-loader\src\index.js, E:\Documents\CODE\WebDev\NextJs\vai\node_modules\next\dist\compiled\mini-css-extract-plugin\loader.js)
info  - Creating an optimized production build .<t> [webpack.cache.PackFileCacheStrategy] resolve build dependencies: 434.2309 ms
    [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Error snapshotting file timestamp hash combination of E:\Documents\CODE\WebDev\NextJs\vai: Error: EINVAL: invalid argument, read
<t> [webpack.cache.PackFileCacheStrategy] snapshot build dependencies: 5.6763 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 E:\Documents\CODE\WebDev\NextJs\vai\node_modules\next\dist\compiled\webpack\bundle5.js:65788:13        at jobError (E:\Documents\CODE\WebDev\NextJs\vai\node_modules\next\dist\compiled\webpack\bundle5.js:42867:5)
        at E:\Documents\CODE\WebDev\NextJs\vai\node_modules\next\dist\compiled\webpack\bundle5.js:42931:10        at E:\Documents\CODE\WebDev\NextJs\vai\node_modules\next\dist\compiled\webpack\bundle5.js:43798:13        at E:\Documents\CODE\WebDev\NextJs\vai\node_modules\next\dist\compiled\webpack\bundle5.js:121039:5        at Hook.eval [as callAsync] (eval at create (E:\Documents\CODE\WebDev\NextJs\vai\node_modules\next\dist\compiled\webpack\bundle5.js:141008:10), <anonymous>:6:1)
        at AsyncQueue._handleResult (E:\Documents\CODE\WebDev\NextJs\vai\node_modules\next\dist\compiled\webpack\bundle5.js:121009:21)
        at E:\Documents\CODE\WebDev\NextJs\vai\node_modules\next\dist\compiled\webpack\bundle5.js:120992:11
        at E:\Documents\CODE\WebDev\NextJs\vai\node_modules\next\dist\compiled\webpack\bundle5.js:43747:12        at E:\Documents\CODE\WebDev\NextJs\vai\node_modules\next\dist\compiled\webpack\bundle5.js:20032:16    [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Error snapshotting file timestamp hash combination of E:\Documents\CODE: Error: EINVAL: invalid argument, read
    [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Error snapshotting file timestamp hash combination of E:\Documents\CODE\WebDev\NextJs: Error: EINVAL: invalid argument, read
    [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Error snapshotting file timestamp hash combination of E:\Documents\CODE\WebDev: Error: EINVAL: invalid argument, read
    [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Error snapshotting file timestamp hash combination of E:\Documents\CODE\WebDev\NextJs\vai\node_modules: Error: EINVAL: invalid argument, read      
    [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Error snapshotting file timestamp hash combination of E:\: Error: EINVAL: invalid argument, read
    [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Error snapshotting file timestamp hash combination of E:\Documents\CODE\WebDev\NextJs\vai\node_modules\@next: Error: EINVAL: invalid argument, read    [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Error snapshotting file timestamp hash combination of E:\Documents: Error: EINVAL: invalid argument, read
    [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Error snapshotting file timestamp hash combination of E:\Documents\CODE\WebDev\NextJs\vai\node_modules\@napi-rs: Error: EINVAL: invalid argument, read
<t> [webpack.cache.PackFileCacheStrategy] restore cache container: 13.2931 ms
    [webpack.cache.PackFileCacheStrategy] Restored pack from E:\Documents\CODE\WebDev\NextJs\vai\.next\cache\webpack\server-production.pack, but version doesn't match.
info  - Creating an optimized production build ..    [webpack.cache.PackFileCacheStrategy] Pack got invalid because of write to: Compilation/modules|E:\Documents\CODE\WebDev\NextJs\vai\node_modules\next\dist\build\webpack\loaders\next-swc-loader.js??ruleSet[1].rules[2].oneOf[2].use!E:\Documents\CODE\WebDev\NextJs\vai\pages\_app.tsx
    [webpack.cache.PackFileCacheStrategy] Storing pack...
    [webpack.cache.PackFileCacheStrategy] Capturing build dependencies... ()
<t> [webpack.cache.PackFileCacheStrategy] resolve build dependencies: 1.5527 ms
<t> [webpack.cache.PackFileCacheStrategy] snapshot build dependencies: 0.1128 ms
    [webpack.cache.PackFileCacheStrategy] Captured build dependencies
    [webpack.cache.PackFileCacheStrategy] 27 fresh items in cache put into pack 0
<t> [webpack.cache.PackFileCacheStrategy] store pack: 19.4331 ms
    [webpack.cache.PackFileCacheStrategy] Stored pack (27 items, 1 files, 0 MiB)
info  - Creating an optimized production build
Failed to compile.

Error: EISDIR: illegal operation on a directory, readlink 'E:\Documents\CODE\WebDev\NextJs\vai\pages\_app.tsx'

@langford-bc
Copy link

I'm having a similar Webpack error.

The message is the following: [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Unable to snapshot resolve dependenc
ies
[webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Unable to snapshot resolve dependenc
ies

What version of Next.js are you using?
12.0.7

What version of Node.js are you using?
v14.17.3

What browser are you using?
Chrome

What operating system are you using?
Mac OS Catalina

How are you deploying your application?
Not deployed yet

I enabled debug logging but could not come up with a sense of what the issue could be. There are only three development dependencies in the project: next, react and react-dom

Thanks

@balazsorban44
Copy link
Member

Hi, I could not reproduce this with the OP's reproduction steps, but there is a similar issue opened at #33693 (which I could reproduce). If you think your issue is related, feel free to follow along with that one. If you get a similar warning but you don't think it's the same as #33693, please open a new bug report with a reproduction instead.

@balazsorban44 balazsorban44 added the Webpack Related to Webpack with Next.js. label Jan 27, 2022
@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. Webpack Related to Webpack with Next.js.
Projects
None yet
Development

No branches or pull requests

5 participants