Deploy of Hugo site failed (Victor Hugo, Strata theme)

Hello,
This would be my first deploy of a generated static site.
Trying Hugo (Victor with Strata theme) and Netlify for the first time.
All is wel locally. The site runs and shows up in Firefox.
Pushing to master on Git hub seems fine too.
In deploying to Netlify (from the Github repo) I get errors at the end of the log file.
This is the first ERR! I see:
ERROR in ./src/index.js
12:04:26 PM: Module not found: Error: Can’t resolve ‘./css/main.css’ in ‘/opt/build/repo/src’

Last is:
Build script returned non-zero exit code: 2

Using npm version 6.9.0
and node version 10.16.1 (10.16.2 is current on Netlify I think)

Any thoughts on where to check/ change stuff?

Kind regards,

Erik Crins

p.s. maybe I should add this:
https://app.netlify.com/sites/jovial-kalam-8ac11d/deploys/5d4e96821109a8978435dcb3

Hi @e-crins ! I assume you can build locally? This looks like something your build pipeline relies on is literally missing (or not where your code expects to find it) during build so I am surprised to hear you say (I think) that you can.

If you can build locally, have you synced versions of everything you use locally with our build environment? This should include not just node but also yarn (which we use for your site instead of npm since you have a /yarn.lock file), and hugo?

Hi @fool !
Yes locally all is well.
I’ll synch again with the Git Hub Repo.
I followed these steps:


I’lll look into yarn. I think that might be what’s missing.
Node, npm, Hugo, Victor and Strata are there…

I’d have to delete the current site…
More nest this afternoon.

Erik

1 Like

keep us informed either way! :slight_smile:

Hmmmm.
Deleted the site on Netlify.
Deleted the Github Repo
Tried the site locally… Works!
Created a new repo ‘mediviz’ and pushed to master.
Linked Netlify to the repo and setup a new site.
In the deploy settings I see ‘npm build’ as a command to build the site.
I see there’s still a yarn.lock file in my repo… I don’t use yarn localy.
I used nmp to make the site locally.

In the log there’s still the “Build script returned non-zero exit code: 2”

And I read: " 10:05:48 AM: Installing yarn at version 1.12.1

10:05:48 AM: Installing Yarn!

Is that odd?

And there is: “10:05:41 AM: Found netlify.toml. Overriding site configuration”
In the log file.
I think I changed that file when following the strata theme setup tutorial.
First few lines of that file:
[build.environment]
YARN_VERSION = “1.12.1”
NPM_VERSION = “6.4.1”
HUGO_VERSION = “0.55.6”

Should I delete the YARN…12.1 line?

I think I’ll try a new site with just Victor Hugo… no theme…

Take small steps.

If your build command is ‘npm build’, I would recommend removing the yarn.lock file and the YARN_VERSION env var. That should make sure that our buildbot uses NPM instead of Yarn. Let me know if that helps.

Hi Dennis.
Thanks for the hints.
I deleted the yarn.lock file and YARN_VERSION in the front matter of the netlify.toml file.
No luck. Still the same final error.

But the first few errors and hints of errors are about npm…

There’s:
WARN deprecated flatten@1.0.2: I wrote this module a very long time ago; you should use something else.

ERROR in ./src/index.js
5:54:18 PM: Module not found: Error: Can’t resolve ‘./css/main.css’ in ‘/opt/build/repo/src’
5:54:18 PM: @ ./src/index.js 2:0-24

Failed at the victor-hugo@1.0.0 build:webpack script.

Any ideas?
Can/should I build with yarn instead?

Erik

Hi, @e-crins. I don’t believe the current error is related to the module/dependency install but is instead an issue with a missing file or incorrect file reference.

I made a fresh clone of the repo and I’m getting the same error:

Hash: 31505a0b75cd7f1b3682
Version: webpack 4.39.2
Time: 480ms
Built at: 08/19/2019 1:43:33 AM
 1 asset
Entrypoint main = main.31505.js
[0] ./src/index.js 122 bytes {0} [built]

ERROR in ./src/index.js
Module not found: Error: Can't resolve './css/main.css' in '/Users/me/tmp/mediviz/src'
 @ ./src/index.js 2:0-24

When I search for the file (/Users/me/tmp/mediviz/src/css/main.css), it is not part of the repo. I believe this is the root cause of this error.

I’m not sure why this error is occurring. Possible solutions may include creating the expected file (./css/main.css) with the required content or changing the file reference to point to the actual location of the file to be used (for example ./css/imports/reset.css - if that is indeed the correct CSS file).