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

ParseError: /node_modules/nft.storage/src/carbites/treewalk.js #1169

Closed
huweihong opened this issue Jan 26, 2022 · 4 comments
Closed

ParseError: /node_modules/nft.storage/src/carbites/treewalk.js #1169

huweihong opened this issue Jan 26, 2022 · 4 comments
Labels
kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization

Comments

@huweihong
Copy link

When I imported nft.storage in a svelte routify project, I got the following error:

ParseError: /node_modules/nft.storage/src/carbites/treewalk.js
Error: ENOENT: no such file or directory, open '/frontend/node_modules/nft.storage/src/carbites/treewalk.js'
    at compileModule (/frontend/node_modules/nollup/lib/impl/NollupCompiler.js:116:19)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async compileModule (/frontend/node_modules/nollup/lib/impl/NollupCompiler.js:114:13)
    at async compileModule (/frontend/node_modules/nollup/lib/impl/NollupCompiler.js:114:13)
    at async compileModule (/frontend/node_modules/nollup/lib/impl/NollupCompiler.js:114:13)
    at async compileInputTarget (/frontend/node_modules/nollup/lib/impl/NollupCompiler.js:138:5)
    at async Object.compile (/frontend/node_modules/nollup/lib/impl/NollupCompiler.js:235:31)
    at async generateImpl (/frontend/node_modules/nollup/lib/index.js:13:21)

the file is not existing in node_module, after checking the node_module. what is this file for? and how to resolve it?

my env: ts + svelte + routify.

thanks.

@huweihong huweihong added kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization labels Jan 26, 2022
@yusefnapora
Copy link
Contributor

@huweihong, thanks for the report. I haven't used ts + svelte personally so I'm not sure what's up exactly. The treewalk.js file doesn't actually exist in the nft.storage package - it's from the carbites module, which nft.storage depends on.

I notice you're using nollup - can you try with rollup as well and see if you get the same error? Just a guess that the bundler might be involved, since it seems to be a module resolution problem.

Thanks :)

@vasco-santos
Copy link
Contributor

Hello @huweihong

We use a feature of package json called exports to map paths to where the source files are. https://github.com/nftstorage/carbites/blob/main/package.json#L52

In this case, you seem to be using and environment that does not support it. It seems to exist since https://nodejs.org/api/packages.html#exports . So as @yusefnapora mentioned, this is likely related to your bundler. rollup/plugins#208

@alanshaw
Copy link
Contributor

Not sure what was going on here. This seems to be working for me in this example project: https://github.com/alanshaw/svelte-restify-nftstorage-example

(I added NFTStorage class to the window and then used it from the console)

Screenshot 2022-02-28 at 15 14 13

@mondyfy
Copy link

mondyfy commented Dec 4, 2022

Had a similar issue in ts, fixed after upgrading ts-node and jest(for testing) to the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

5 participants