Getting npm resources in a "Create a Website" project fails


#1

I used the new Create a Website project but I no longer see a way to get npm packages for the application.
I tried to use the console to run npm init and npm install require and it seems to run successfully but the node_modules folder isn’t getting populated.

I’m also now getting errors like the following in the console:

/tmp/.__glitch__start.sh: line 1: null: command not found

link to glitch

  1. Is there a way to use resources from npm in the Create a Website style projects? Would I instead have to rely on something like https://unpkg.com?

  2. Is there a way to have a build step to make an Angular web app, etc?


#2

If you want to add npm modules, add a package.json file to your project (or just select ‘create a node app’ when creating a new project). You’ll then be able to include them as you can in an ordinary ‘glitch app’. The ‘Glitch website’ option is intended for static websites, and use resources like unpkg for including libraries etc.


#3

Thank you! I have a bit better of an idea of the difference between the two modes.

This might be more general feedback then for Create a Website style projects:

  • I can’t distinguish them visually from Create a Node App projects. Having some kind of icon like private projects do might be helpful.

  • The new button inside a glitch does not give the same options.

  • Creating a file called package.json in Create a Website style projects seems to break the project even though package.json is not supported in these types of projects.


#4

It doesn’t break it per se, adding it means you’re taking over responsibility for the web server from the default one we bundle in static projects, so you need to set up route handling etc. My suggestion would be to just create a node app, and port any pages over.