stackblitz / webcontainer-core

Dev environments. In your web app.
https://webcontainers.io
MIT License
3.89k stars 160 forks source link

development server #936

Open futuremillionaire14 opened 1 year ago

futuremillionaire14 commented 1 year ago

Describe the bug

Having issues with getting my development server to function. Surely it is an easy fix. I simply tried npm start to set up my development server but I keep getting a json file not found error but I have a Json package. I am sure I am over thinking it but a brand new set of eyes would help. At this point the project should at show up in the development server and display the bare bones with no errors. I am pretty sure when I started the project it had a development server...any help would be great. Too far into the project to ditch it. Thanks again!

Link to the blitz that caused the error

https://stackblitz.com/edit/node-jd7clw?file=frontend%2Fsrc%2FControllers%2FbugController.js,frontend%2Fsrc%2FApp.js

Steps to reproduce

none

Expected behavior

dev server with Login: username box and password

Parity with Local

Screenshots

none

Platform

Browser name  = Chrome
Full version  = 103.0.0.0
Major version = 103
navigator.appName = Netscape
navigator.userAgent = Mozilla/5.0 (X11; CrOS x86_64 14816.131.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
performance.memory = {
  "totalJSHeapSize": 158018059,
  "usedJSHeapSize": 148362183,
  "jsHeapSizeLimit": 2062548992
}
Hash = 8dd2e1d89f7d2e6b43a2b4af08588e58ffd9a2ea

Additional context

none

fvsch commented 1 year ago

Hi @futuremillionaire14.

Looking at your project I found a couple issues:

These Terminal commands seem to work in your project:

cd frontend
mv 'package.json ' 'package.json'
npm install
npm start

After that, webpack seems to start in development mode correctly, but there are still some errors in your code:

futuremillionaire14 commented 1 year ago

Thank you very much for your thorough response Florens. I am still somewhat of a novice at coding so any feedback helps. Have a great day!

All the best

On Mon, Jan 9, 2023 at 1:58 PM Florens Verschelde @.***> wrote:

Hi @futuremillionaire14 https://github.com/futuremillionaire14.

Looking at your project I found a couple issues:

  • Your package.json and code are in a subfolder named frontend. Because of that, StackBlitz is not finding a package.json at the root of the project and will not try to install npm dependencies or run a start command (which would be npm start for this project).
  • On top of that, your package.json file is actually named package.json , with a trailing space. So it's technically not named package.json, and not recognized by tools.

These Terminal commands seem to work in your project:

cd frontend mv 'package.json ' 'package.json' npm install npm start

After that, webpack seems to start in development mode correctly, but there are still some errors in your code:

  • One file is importing a module that doesn't exist.
  • You're trying to use ReactDOM.render from 'react-dom/client' but that render method doesn't exist. I think you might have code intended for React 16 or 17, but might be trying to use it with React 18, and the exports have changed in React 18.

— Reply to this email directly, view it on GitHub https://github.com/stackblitz/webcontainer-core/issues/936#issuecomment-1376132580, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4UMI3SAZH2HRJWB2EDMWHTWRRNVLANCNFSM6AAAAAATVWDBKI . You are receiving this because you were mentioned.Message ID: @.***>

futuremillionaire14 commented 1 year ago

Actually a couple of more things for you. Bare with me, I am a novice at this. Do you think my code is salvageable? Or should I scrap it and start again. I am incorporating the things you mentioned but I am still having issues. I don't want really want to start over.

Thank you for your patience.