Skip to content

Commit

Permalink
Improve error message for "SHA1 not computed"
Browse files Browse the repository at this point in the history
Summary:
This error message isn't accurate since Metro added symlink support, and doesn't suggest the most likely cause, which is that the requested file isn't watched.

Metro's resolver should never resolve an unwatched file, but custom resolvers (like `rnx-kit`'s) might.

Changelog: Internal

Reviewed By: vzaidman

Differential Revision: D69397742

fbshipit-source-id: 2fd141387d3201ed321d644c80618b3bc12052b5
  • Loading branch information
robhogan authored and facebook-github-bot committed Feb 16, 2025
1 parent 7848fd1 commit a22d509
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/metro/src/node-haste/DependencyGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,12 @@ class DependencyGraph extends EventEmitter {

if (!sha1) {
throw new ReferenceError(
`SHA-1 for file ${filename} is not computed.
`Failed to get the SHA-1 for ${filename}.
Potential causes:
1) You have symlinks in your project - watchman does not follow symlinks.
2) Check \`blockList\` in your metro.config.js and make sure it isn't excluding the file path.`,
1) The file is not watched. Ensure it is under the configured \`projectRoot\` or \`watchFolders\`.
2) Check \`blockList\` in your metro.config.js and make sure it isn't excluding the file path.
3) The file may have been deleted since it was resolved - try refreshing your app.
4) Otherwise, this is a bug in Metro or the configured resolver - please report it.`,
);
}

Expand Down

0 comments on commit a22d509

Please sign in to comment.