-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
Build errors when project contains a symlink #8238
Comments
Fixed recently 👍 |
Same appears to happen when I have a symlink to a folder:
|
This still happens to me with broken links. For instance: host:next.js kjmph$ ln -s notexists examples/basic-css/pages/testfile
host:next.js kjmph$ yarn next ./examples/basic-css/
yarn run v1.22.10
$ node --trace-deprecation packages/next/dist/bin/next ./examples/basic-css/
ready - started server on http://localhost:3000
[Error: ENOENT: no such file or directory, stat '/home/kjmph/next.js/examples/basic-css/pages/testfile'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: '/home/kjmph/next.js/examples/basic-css/pages/testfile'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. |
@acifani this should be reopened |
in your next.config.js add this
|
Before this gets locked and unable to comment, like #15278, disabling symlinks isn't always appropriate. I believe The problem with broken links and emacs lock files is this code: next.js/packages/next/lib/recursive-readdir.ts Lines 30 to 31 in b60c943
When a symlink is encountered, recursiveReadDir tries and stat the file. This can lead to next.js/packages/next/lib/typescript/getTypeScriptIntent.ts Lines 29 to 33 in b60c943
Or!!! recursiveReadDir should gobble those |
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. |
Bug report
Describe the bug
Next commands
build
anddev
error out whenever there is a symbolic link in a directory within the projectTo Reproduce
Either
ln -s source_file dest_file
) in an directory of an existing projectExpected behavior
Build should not error out, whether or not it should follow the symlink I don't know
Screenshots
Error output:
System information
Additional context
The exception is caused by the build checking for possible TypeScript files. More specifically, by
fs.statSync
in this line. There's a separate command, fs.symlinkLink, available for symlinksThe text was updated successfully, but these errors were encountered: