Debugging Deploy from Github Repo where npm couldn't find package.json

Hello Netlify Community!

I need some help debugging a deploy for a static site with just a few html files and a css stylesheet.

Basically, I followed the handy guide to continuous deployment step-by-step (even created a project folder named ‘project’ with all of the html/css for my very simple static webpage I want to deploy) and yet…the deploy still failed. I don’t have a build tool like Jekyll for the site, just the html/css. From what I gleaned from your website it seems like I should be using the following settings:

Base directory: project
Build command: npm run build
Publish directory: project/_site (note that the article I read to put these settings on specified no space after the root directory but in my Netlify Build & Deploy settings it automatically added a space after like this: project/ _site

I thought this would be a rather simple deploy as there aren’t that many files or complex logic associated with it. I am new to web developement and am just stumped as to what to do next. This is the error message I get on deployment.

7:06:51 PM: Build ready to start
7:06:53 PM: build-image version: 9e0f207a27642d0115b1ca97cd5e8cebbe492f63
7:06:53 PM: build-image tag: v3.3.2
7:06:53 PM: buildbot version: 8727aab446158e7b8c8ad2e96fe74b0154505a4e
7:06:53 PM: Fetching cached dependencies
7:06:53 PM: Starting to download cache of 255.0KB
7:06:53 PM: Finished downloading cache in 116.467444ms
7:06:53 PM: Starting to extract cache
7:06:53 PM: Failed to fetch cache, continuing with build
7:06:53 PM: Starting to prepare the repo for build
7:06:53 PM: No cached dependencies found. Cloning fresh repo
7:06:53 PM: git clone https://github.com/anesta95/Personal_Portfolio_Site
7:06:54 PM: Preparing Git Reference refs/heads/master
7:06:54 PM: Starting build script
7:06:54 PM: Installing dependencies
7:06:56 PM: Downloading and installing node v10.16.3...
7:06:56 PM: Downloading https://nodejs.org/dist/v10.16.3/node-v10.16.3-linux-x64.tar.xz...
7:06:57 PM:   0.5%
7:06:57 PM: 
#
7:06:57 PM:                2.4%
7:06:57 PM: 
###                                                                        4.7%
7:06:57 PM: 
######
7:06:57 PM:                            9.4%
7:06:57 PM: 
###########
7:06:57 PM:              16.3%
7:06:57 PM: 
################
7:06:57 PM:                                  23.3%
7:06:57 PM: 
##########################
7:06:57 PM:      36.6%
7:06:57 PM: 
#####################################
7:06:57 PM:          52.5%
7:06:57 PM: 
##################################
7:06:57 PM: #####################                   76.7%
7:06:57 PM: 
########################################################################
7:06:57 PM: 100.0%
7:06:57 PM: Computing checksum with sha256sum
7:06:58 PM: Checksums matched!
7:07:00 PM: Now using node v10.16.3 (npm v6.9.0)
7:07:01 PM: Attempting ruby version 2.6.2, read from environment
7:07:02 PM: Using ruby version 2.6.2
7:07:03 PM: Using PHP version 5.6
7:07:03 PM: Started restoring cached go cache
7:07:03 PM: Finished restoring cached go cache
7:07:03 PM: unset GOOS;
7:07:03 PM: unset GOARCH;
7:07:03 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
7:07:03 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
7:07:03 PM: go version >&2;
7:07:03 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
7:07:03 PM: go version go1.12 linux/amd64
7:07:03 PM: Installing missing commands
7:07:03 PM: Verify run directory
7:07:03 PM: Executing user command: npm run build
7:07:03 PM: npm
7:07:03 PM: ERR!
7:07:03 PM: path /opt/build/repo/project/package.json
7:07:03 PM: npm
7:07:03 PM: ERR! code
7:07:03 PM:  ENOENT
7:07:03 PM: npm
7:07:03 PM: ERR! errno -2
7:07:03 PM: npm
7:07:03 PM: ERR! syscall
7:07:03 PM:  open
7:07:03 PM: npm ERR!
7:07:03 PM:  enoent ENOENT: no such file or directory, open '/opt/build/repo/project/package.json'
7:07:03 PM: npm
7:07:03 PM: ERR! enoent This is related to npm not being able to find a file.
7:07:03 PM: npm ERR! enoent
7:07:03 PM: npm
7:07:03 PM:  ERR! A complete log of this run can be found in:
7:07:03 PM: npm ERR!     /opt/buildhome/.npm/_logs/2019-10-13T23_07_03_729Z-debug.log
7:07:03 PM: Skipping functions preparation step: no functions directory set
7:07:03 PM: Caching artifacts
7:07:03 PM: Started saving pip cache
7:07:03 PM: Finished saving pip cache
7:07:03 PM: Started saving emacs cask dependencies
7:07:03 PM: Finished saving emacs cask dependencies
7:07:03 PM: Started saving maven dependencies
7:07:03 PM: Finished saving maven dependencies
7:07:03 PM: Started saving boot dependencies
7:07:03 PM: Finished saving boot dependencies
7:07:03 PM: Started saving go dependencies
7:07:03 PM: Finished saving go dependencies
7:07:07 PM: Error running command: Build script returned non-zero exit code: 254
7:07:07 PM: Failing build: Failed to build site
7:07:07 PM: failed during stage 'building site': Build script returned non-zero exit code: 254
7:07:07 PM: Finished processing build request in 14.11222609s

From what I read about the error message it seems like the npm (I don’t really know what this is) build command couldn’t find a package.json file that it looks like it needs to build the site. Are these files needed for even simple static sites with just html/css. If so, what do I put in it?

Thank you guys in advance for the help.

Hiya!

First of all, welcome to community! We’re super happy that you’re trying netlify and I promise this won’t be confusing for very long.

Secondly, you do not need npm (node package manager) if you are only deploying a html/css site. In that case, all you need to do is connect netlify to the github repo. if you have an index.html at the top level of directory that is your github repo, you do not need to set up any directories, and you can just leave these settings blank:

Screen Shot 2019-10-14 at 09.46.52

the build command and publish directory refer to sites that are generated, for example, with a static site generator such as Gatsby or Hugo, where javascript is processed and turned into html. In those cases, we also need to install developer tooling and dependencies to run those processes. That’s what the package.json is for - it tells npm which packages are needed for the particular chain of build processes you’ve set up for this site. They can vary really widely, so dependency managers like npm only go fetch the ones needed for this specific situation. the list of things you need is in that package.json file.

tldr; you don’t need a package.json,one if you are manually building a static site with html and css (and JS, such as, for example, jQuery to do DOM manipulation and other stuff), as you are not using npm as you don’t need packages or a build pipeline.

Does this make sense?