Can't find build.js. I have NO IDEA what I'm doing

I used to be able to find JS projects on github and just download them and use them. I’m having problems with a group of JS projects I want to check out. For each I try I get an error stating it can’t find build.js. There is no build.js within the downloaded projects.

https://github.com/ngokevin/aframe-template-component

It gives instructions on how to install with NPM below but I guess I don’t recall or quite understand how to do that. I’m also not sure if that relates to some sort of “build” process for this project.

I don’t understand why people are compiling JS projects now. Feel free to insult me if you want.

2 Likes

When I try to use NPM, I get this error: npm WARN enoent ENOENT: no such file or directory

Also just via the browser. Is that worth trying?

Well, I know how to just download the specific files for installation. I’m actually trying to use the examples. I unfortunately forgot to specify that. The download itself contains some examples that require a build.js which is not included.

In a sense my question is broad. How do I build this project? In order to build is, is that done through the NPM installation? Also, why?

Would it be worth just installing Node.js (it includes npm). The chances are you’ll comes across the requirement at some future point anyway, if you are looking at the kind of packages you’re describing. My experiences (on Windows) with it has been very straightforward so far, though my use has largely been for installing linters in SublimeText3.

1 Like

package.json contains a scripts section for different tasks, the one you’re after is “build” which can be run from the command line.

npm install
npm run build

Why? npm is the way most js developers share packages so that you can easily share something, install and get it running.

3 Likes

Thank you very much. Now I need to know what browserify is. I’ll probably just stop here and move on. Thanks.

Failed at the aframe-template-component@1.1.0 build script ‘browserify examples/main.js -o examples/build.js’.

No problemo. That doesn’t look like it’s the complete error to me.

Did you run npm install first? That should install browserify as it’s listed in the dependencies in package.json.

1 Like

I’d recommend reading this: Understanding JavaScript Modules: Bundling & Transpiling

3 Likes

That looks like a great article :slight_smile:

3 Likes

I did. There’s obviously a lot I need to learn but I’m not going to lie, I wish it wasn’t this complicated. It drives me crazy that I have to install so many things in order to perform tasks but I understand that’s the JS scene currently. I’ll do some more reading.

missing script: install

1 Like

I’ll check that out. Thanks.

Oh wait. I typed npm run install by mistake.

Sorry, that was my bad. I originally posted it as npm run install it just needs to be npm install

It’s worth taking a little time to understand npm, it’s a very important piece of tech.
It’s actually meant to simplify things, when looking at a new project all you have to do is npm install and then you have all the dependencies needed.

1 Like

I’ve used it very casually and I guess I can’t get away with that any longer. So presumably after this is all installed, this has to run on a node server?

1 Like

Mine is just running on my Windows 10 laptop. There’s no suggestion that I’m running a Node server as such, though it could be what’s running in the background - I just don’t see it.

Nope, it’s just static files so you can just open the examples in your browser.
Here’s the four steps I took to get the example running.

git clone git@github.com:ngokevin/aframe-template-component.git
npm install
npm run build
open examples/basic/index.html

The first step when loading a lot of these types of projects is to look through package.json to see what scripts they contain and look at the dependencies. Projects should have Installation instructions in the readme too, but this one doesn’t have much.

4 Likes

Okay. Well, I better understand how to make sense of these package.jsons and work with it. I got it working. I appreciate it. I have a lot of catching up.

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.