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

Error: ENOENT: no such file or directory #1291

Closed
SebastianPetric opened this issue Mar 4, 2022 · 7 comments · Fixed by #1396 or #1398
Closed

Error: ENOENT: no such file or directory #1291

SebastianPetric opened this issue Mar 4, 2022 · 7 comments · Fixed by #1396 or #1398

Comments

@SebastianPetric
Copy link

Hey, I get following error and more of the same type, when trying to call the parse() method:

WARNING in ./node_modules/tldts-core/dist/es6/src/is-valid.js Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): Failed to parse source map from '/Users/sepe/IdeaProjects/my-project/node_modules/tldts-core/src/is-valid.ts' file: Error: ENOENT: no such file or directory, open '/Users/sepe/IdeaProjects/my-project/node_modules/tldts-core/src/is-valid.ts'

It also fails to find suffix-trie.ts, trie.ts, index.ts, subdomain.ts,...
I am using version 5.7.67 but it also accurs with older versions. We are using a react 17 project, with node 16 and typescript 4.5.5. In node_modules the packages tldts and tlds-core do exist...Do you have an idea what the problem could be in this case?

@remusao
Copy link
Owner

remusao commented Mar 5, 2022

Hi @SebastianPetric,

Thanks for reaching out. Could you please indicate the steps you have taken to install tldts as well as a small script that I could use to reproduce this issue on my end? It would be very useful. From what I can see in the error it could also be an issue with the bundling or the way the project runs, but I would need more specific steps to reproduce the issue.

Thanks,

@iStefo
Copy link

iStefo commented Jul 27, 2022

We get a lot of those warnings when building our create-react-app with react-scripts 5.
I think the problem is that the build tool uses source-map-loader which attempts to load source maps of all imported dependencies.

While the source maps to all of tldts' files can be found, the original source can not, as its not part of the npm package.
TBH, as we see this warning with multiple packages, I'm not sure whether the package authors should fix this at all by

a) including the original source code as files in the npm package or
b) including the original source code within the source map under the sourcesContent key or
b) removing the source map reference as it's no use without one of the above options

or whether react-scripts should silence the warning or something. (See discussion thread facebook/create-react-app#11767)

@remusao
Copy link
Owner

remusao commented Jul 28, 2022

Thanks for all the details @iStefo, I tried locally and including the source in the npm package does not increase significantly the size of the compressed archive so we could do that. Would it be enough to add the src folder to solve the issue (this is what I understood from option a))?

@iStefo
Copy link

iStefo commented Jul 29, 2022

Thanks for your response.
I tried out building the packages locally and using npm link to integrate them into our app. And yes, having the source files available resolves the warnings.

So I would suggest you simply include the source in the distributed package if that's no hassle for you. It may help out all the create-react-app users out there using this package :)

@remusao
Copy link
Owner

remusao commented Jul 31, 2022

https://github.com/remusao/tldts/releases/tag/v5.7.86 contains the sources, let me know if this solves the issues you encountered so far.

@iStefo
Copy link

iStefo commented Aug 1, 2022

Hi @remusao, it fixed all errors except for the following two:

WARNING in ./node_modules/tldts-core/dist/es6/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/istefo/Developer/admin_gui/node_modules/tldts-core/index.ts' file: Error: ENOENT: no such file or directory, open '/Users/istefo/Developer/admin_gui/node_modules/tldts-core/index.ts'

WARNING in ./node_modules/tldts/dist/es6/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/istefo/Developer/admin_gui/node_modules/tldts/index.ts' file: Error: ENOENT: no such file or directory, open '/Users/istefo/Developer/admin_gui/node_modules/tldts/index.ts'

So its probably just that you missed those two files as they are not in src/. Apart from that: Great work & thanks!

@remusao
Copy link
Owner

remusao commented Aug 1, 2022

Indeed. Sorry about that, I will push another update to address this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants