Needed dependencies at deplyoment

I’m deploying this page via netlify and i got my html/css working allllrighty… But since i got particles library installed with npm, and node_modules is ignored with .gitignore i’m getting error particles not found. So how do i work around that? Is there way to negate specific parts(folders) of node_modules in gitignore file or um some better way to deal with that? I guess there should be some “easier” way, dont know how practical would that be with 313 dependencies…am i right… am i right dude Walter(Big Lebowski) voice(i think…)?

How are you including the library on your web page? The reason node_modules is ignored is because it shouldn’t exist in the end product - when used for managing front-end code, what should be included on the page is a bundle or bundles of all the JS used (so what you end up with is often one HTML file, one CSS file and one JS file)

What does your project look like? Do you have a link to the GitHub? Are you using package.json and npm? If so, you can follow my tutorial on deploying a Random Quote Machine to Netlify:

Hopefully this helps. If not, please link your GitHub project and we’ll figure it out!

Yeah i understand that, but netlify goes and gets my github repo and i guess it just looks at index.html and then goes for those other files(css, js) linked in index.html right? Because i have my scss files compiled to main.css file which works fine and my linked app.js file also works fine, it is just particles library that does not. And it works fine on local server…
Um i am not sure how i am including it… i guess like this:
<script src="/node_modules/particles.js/particles.js"></script>
And then i have:

// //  ------------- PARTICLES ---------------
// /* particlesJS.load(@dom-id, @path-json, @callback (optional)); */
// particlesJS.load('particles-js', '/assets/particles.json', function () {
// 	// console.log('callback - particles.js config loaded');
// });

in app.js. (its commented out to make other js functionality work…error was occurring on particles line).

Thanks for video… um I’m sure… going to try import syntax…if that might be a thing… although i was fallowing docs on including it, it works fine when i open with live server.
I am using package.json and npm, i mean npm just to compile my scss files, it doesnt have much to do with particles library, ah well beside particles library is installed with it heh… but um yeah… there is github repo:

ps. its not finished and a bit messy but i wanted see how it looks so far, and have it up while adding new stuff

You can try downloading the particles.js file and adding it to your list of required scripts in the index.html. That solution doesn’t require the node modules.

Netlify runs npm install prior to building it so I don’t think it’s missing the package. What build folder are you specifying before deployment?

Yeah, thanks, i will try that tomorrow if i dont get one from node modules to work… Although wonder what i am doing wrong, its more about that than having particles on website.

Hm i am not quite sure i understand what build folder is. If you’re talking about netlify publish directory i haven’t specified any because i doesn’t have build command. I dont think i need build command, got only one app.js, one css file and index.html… or maybe i do need it?

i got: Failed to load resource: the server responded with a status of 404 ()
And i think thats because there is no node_modules on my github for netlify to get particles.js file… Oh i see… so would import do the job there? is that how import works, i probably wouldn’t even need to link particles in index.html file then and just use it in app as it is… Ah i should try it before even post this one… but i’m too tired right now…
And thanks everyone for replies.

Oh i totally forgot you said it runs npm install, i dont know why i’m getting 404 then, it should not be that. GET net::ERR_ABORTED 404… on index.html (particles script tag)

That would be a total bummer if there is a typo… hmm no… my local server works fine.

There is another field during Netlify deployment called “build folder” or something of that nature. That folder should be the root of your application.

Yeah, it doesn’t belong in node_modules because you’re not importing it anywhere, there’s no point using NPM for it. Either link to it from a CDN (for example), or copy the file itself somewhere in your project.