ameerthehacker / blazepack

⚡ Blazing fast dev server powered by sandpack
GNU Lesser General Public License v3.0
234 stars 17 forks source link

No dependencies error #2

Closed Mista-T closed 3 years ago

Mista-T commented 3 years ago

First up, this is great work and looks very promising, so thanks a lot!

I bet it's just a usage error on my part, but when I try to run "blazepack" or "npx blazepack" (doesn't make a difference) locally inside your provided example folders (either "react" or "vanilla"), I get the same following error: "Uncaught Error: No dependencies specified, please specify either a package.json or dependencies."

What am I missing? :-)

Thanks Ameer!

ameerthehacker commented 3 years ago

@Mista-T did you try refreshing and did you run them at the root of the react folder in examples folder.

Mista-T commented 3 years ago

Hi Ameer, thanks for getting back to me!

Yes, I did run blazepack inside either the "examples/vanilla/" or the "examples/react/" folders, the ones containing the package.json files.

Blazepack starts up fine in the terminal, but in the browser I only get a blank screen and the given error above.

Refreshing didn't help either.

Here's a console output, the warnings are only sandbox source maps though. blazepack-error-console

Mista-T commented 3 years ago

Maybe it has to do with a mixed up initialization call on the Sandbox PreviewManager()? It expects the following set of attributes: "(selector, sandboxInfo, options)", but gets supplied: "('#root', { showOpenInCodeSandbox: false })". So I guess the second supplied argument should be the options, but as there are only two given, the PreviewManager doesn't have the correct "sandboxInfo" or mixes that up with the supplied "options"? It does call it's internal function "createMissingPackageJSON(...)" later, which throws the error. Maybe that helps. Cheers!

ameerthehacker commented 3 years ago

@Mista-T got it can you try with latest version?

Mista-T commented 3 years ago

@ameerthehacker I don't see a newer version yet, sorry.

Mista-T commented 3 years ago

Re-checked again with blazepack@0.0.13 and the same error is being thrown, sorry. Edit: I updated the example folders a la v0.0.13 and now the react example shows up, but subsequent file changes are not being watched or reloaded. The vanilla example still throws the same error.

ameerthehacker commented 3 years ago

can you try it on a fresh create react app?

Mista-T commented 3 years ago

Hi Ameer, I tried again with a freshly globally installed blazepack v0.0.15. Created a new react template project in an empty folder:

[XY:path user$ blazepack start cra --template=react
Downloading the template react...
⚡ Blazepack dev server running at http://localhost:3000
Unhandled Sandpack error while running the app.
No dependencies specified, please specify either a package.json or dependencies.
Terminating the server

Same error when I manually change into the newly created project folder ("cra" in my case above) and start blazepack from there.

I'm short on time right now, but hope to be able to dig into code a bit later and maybe could help out here. Cheers!

ameerthehacker commented 3 years ago

@Mista-T this seems weird which os are you using?

Mista-T commented 3 years ago

I'm (still) on macOS Mojave, v10.14.4 Using Node v12.13.0 in the terminal.

jyash97 commented 3 years ago

I tried the same command and it works for me. Though I tried it with npx but it should work with global setup as well. Are you seeing the created directory with the name cra ?

sahilrajput03 commented 3 years ago

Same is happening with me too...

$ blazepack --version
#output: v0.0.16
$ node -v : v14.15.4
$ npm -v : 7.5.2
$ npx -v : 7.5.2

image

Another attempt:

image

But it was working fine yesterday :(

Any possible problems/debugging thing i can try..?

jyash97 commented 3 years ago

Can you verify that you have package.json and in that you have dependencies and main field ?

If not try adding main field in package.json

sahilrajput03 commented 3 years ago

Can you verify that you have package.json and in that you have dependencies and main field ?

If not try adding main field in package.json

Sure,

image

sahilrajput03 commented 3 years ago

Ok got it working, I guess its realted to my earlier directory only, but in other places it works great!!

image

@Mista-T , can you try running blazepack creat command somewhere else than your earlier directory ..?

ameerthehacker commented 3 years ago

@Mista-T closing this, feel free to reopen if you are still facing the issues.

Mista-T commented 3 years ago

Hi guys, sorry for being off for a few days, here's what happened after I tried with the latest blazepack version (v0.0.17) and a fresh, empty directory on my machine:

CT:blazepack-test user$ blazepack create cra --template=react
Downloading the template react...
CT:blazepack-test user$ cd cra/
CT:cra user$ blazepack
⚡ Blazepack dev server running at http://localhost:3000
Unhandled Sandpack error while running the app.
Cannot read property 'code' of undefined
Terminating the server
sahilrajput03 commented 3 years ago

Hi guys, sorry for being off for a few days, here's what happened after I tried with the latest blazepack version (v0.0.17) and a fresh, empty directory on my machine:

CT:blazepack-test user$ blazepack create cra --template=react
Downloading the template react...
CT:blazepack-test user$ cd cra/
CT:cra user$ blazepack
⚡ Blazepack dev server running at http://localhost:3000
Unhandled Sandpack error while running the app.
Cannot read property 'code' of undefined
Terminating the server

So, that means this is still a issue..?

For me trying in different directory just solved the issue.

Can you tell what node, npm version you are using?

mine is:

$ blazepack --version
#output: v0.0.16
$ node -v : v14.15.4
$ npm -v : 7.5.2
$ npx -v : 7.5.2
Mista-T commented 3 years ago

Sure thing, thanks for sticking with me!

$ blazepack --version : v0.0.17
$ node -v : v12.13.0
$ npm -v : 6.14.5
$ npx -v : 6.14.5

I will try again with an updated node version (v14) too later.

Mista-T commented 3 years ago

Sorry guys, it just doesn't work (on my machine):

I updated to the latest LTS node v14.15.5 and then:

$ npx blazepack create cra --template=react
npx: Installed 74 in 3.617s
Downloading the template react...
$ cd cra
$ npx blazepack
⚡ Blazepack dev server running at http://localhost:3000
Unhandled Sandpack error while running the app.
Cannot read property 'code' of undefined
Terminating the server

The create method downloads and installs a new react project just fine, package.json, public and src folders with the respective files are being created correctly. Sandpack doesn't seem to like something on my machine...

I'll grab the source code later and see if I can find something locally...

ameerthehacker commented 3 years ago

hey give it a try by hard reload and also by trying it in incognito

ameerthehacker commented 3 years ago

@Mista-T if you were running on a linux machine, we just released a bug fix for that, do try out the latest version and let me know if you still face any issues