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

"Could not find module in path" error even though installed #2276

Closed
gragland opened this issue Aug 10, 2019 · 5 comments
Closed

"Could not find module in path" error even though installed #2276

gragland opened this issue Aug 10, 2019 · 5 comments

Comments

@gragland
Copy link

gragland commented Aug 10, 2019

🐛 bug report

Description of the problem

I have the npm module analytics installed but I'm seeing the following error in a new React CodeSandbox.

Could not find module in path: 'analytics' relative to '/src/index.js'

The only code I've added to the default React CodeSandbox is this in src/index.js:

import Analytics from 'analytics';

Link to sandbox: https://codesandbox.io/s/gracious-thompson-8730t

Your Environment

Software Name/Version
Сodesandbox PROD-1565017826-4f295f72c
Browser Chrome 76
Operating System macOS 10.13.6
@lbogdan
Copy link
Contributor

lbogdan commented Aug 10, 2019

Hey @gragland ,

It seems to work fine here:

image

@gragland
Copy link
Author

Oh, weird, working for me now as well. Will close this and re-open if I see the issue again.

@gragland
Copy link
Author

gragland commented Aug 10, 2019

Okay seeing this issue again and have error details:

Uncaught (in promise) TypeError: Failed to fetch
sandbox.9b5dc6d7.js:1 GET https://cdn.jsdelivr.net/npm/analytics@0.1.16/lib/analytics.browser.cjs.js net::ERR_FAILED

It's currently not working in this sandbox: https://codesandbox.io/s/4pe06 but is working in the original sandbox I posted.

@gragland gragland reopened this Aug 10, 2019
@gragland
Copy link
Author

@lbogdan Is there any other info I can provide on this? I'm currently using this analytics library in the code that divjoy.com exports to CodeSandbox and seeing a lot of users export broken projects to CodeSandbox. Wondering if there's an issues somehow with the analytics lib (although not sure that would make sense given it seems to be an intermittent problem) or if it relates to CodeSandbox or cdn.jsdelivr.net. Happy to provide any info if it's still not happening on your end with https://codesandbox.io/s/4pe06

@gragland
Copy link
Author

gragland commented Oct 24, 2019

Okay figured out the culprit with the help of @DavidWells. uBlock Origin was blocking the script from being loaded from unpkg, even with it set to "allow all scripts" (presumably because it's loaded from the csb.app domain). Guess it doesn't like anything with the term "analytics" in the path. @lbogdan Not sure if there's an elegant fix on the CodeSandbox side for handling package names that might be blocked by ad blockers. Maybe a CDN path that doesn't have the package name in the url? Maybe you have an idea.

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

No branches or pull requests

2 participants