Porting a heroku app to Glitch - errors


#1

I am trying to port a pure HTML/CSS/JS project https://github.com/kgashok/VideoBurst to run on Glitch.

Here’s the glitch project that is in question - https://glitch.com/edit/#!/kgashok-videoburst-2?path=README.md:1:0

I am getting the following error in the console:

/opt/watcher/app-types/node/start.sh: line 49: null: command not found

What am I doing wrong?


#2

Welcome to Glitch! The code that tells your project to run looks for a line in your package.json scripts section like this:

   "scripts": {
        "start": "[thing that should happen on startup]"
    },

…where the words I have between brackets are what you want to happen when your project starts up. In your project, you might want something like nodemon server & npm start --prefix client.

Good luck!


#3

I tried that but it did not work. I don’t get an error now, that is progress.
But no application screen shows up. What else should I do?


#4

What do you see when you open the Glitch Console?

Also, you could try changing the start command to npm run dev (just as an experiment)


#5

npm run dev also did not work!

As far as the console, nothing showed up in the console (no errors either).


#6

Two things; I think your start command should just be a string: “npm run dev”, not an array as you have right now. I suspect making that change will show you some errors in your logs. Also while you’re troubleshooting your scripts I’d suggest running them in your project’s console - it may reveal errors that get buried in the Logs pane, and might give you a little bit of as shorter feedback loop while you try to fix whatever problems crop up.


#7

Yes, that helped, but still in error mode.

ERROR  ENOSPC: no space left on device, mkdir '/app/.pnpm-store/2/_locks/69956f4ac7b4e53cdf1faa5a7e0187ce1da5129d.lock'


#8

Please try running enable-pnpm in the console - we just rolled out an update to pnpm a few minutes ago and that might have put your project in a bad state temporarily.


#9

Actually @kgashok we think there’s a problem of some sort with your project; we’re looking into it now.


#10

@kgashok it looks like the problem is how you’re running pnpm install in your start script. If you’re looking to run install in the context of the package.json file in your client directory then your start command should look like

cd client && NPM_CONFIG_PRODUCTION=false pnpm install && pnpm run build

Can you give that a shot? You might need to manually fremove the .pnpm-store folder to free up that space: rm -rf .pnpm-store


#11

You’ll also probably need to stop your start script before you remove your .pnpm-store directory, or you’ll be in a sort of race condition while your project keeps trying to install and failing. You could do this by temporarily renaming package.json to package.json.tmp, removing the .pnpm-store directory, putting the correct start script in place, and rrenaming package.json.tmp back to package.json.


#12

No luck…I am doing something wrong. Please enter the project and fix as you deem fit.

Thanks,

% ashok


#13

Ok well you’ve resolved the disk space issue, so that’s a start.

I added && node /app/server.js to your start script to try to get your project to start up fully, but never fully starts due to errors in your /app/server.js file. Because of those errors it never gets to the line where it opens a listener to process.env.PORT. Because it never opens the listener, Glitch tries to start it over and over again, running the full command in your start script and trying to install and build your client.

I’d suggest trying to get things running in the console without doing all the initialization stuff in the start script as a place to begin. Right now I’m seeing the same error I was when I ran npm run dev in a remix; something about Cannot find module './keys_dev'. If you stop your project from continually restarting you can more easily troubleshoot your error in the console but working through them one at a time and assembling a working set of start commands as you fix things. Then you can put that command in your package.json and go from there.

Another thing I’d suggest: on Node project Glitch runs the install and start scripts in that order. You could move your initialization commands to the install script instead of start and your won’t keep retriggering the pnpm install every time your project starts.

Lastly, you could put a watch.json file in place to throttle how often install and start run and what file changes trigger those, which might help quiet the noise down.

Hopefully that will get you at least a little further and you can come back to us with more targetted questions about specific problems. Or perhaps someone else in the community can give some specigic pointers to further places to look.