redbrick / nix-configs

NixOS configs for Redbrick deployment
Apache License 2.0
16 stars 5 forks source link

httpd: add react-site to deployment #57

Closed butlerx closed 8 months ago

m1cr0man commented 4 years ago

Fails to build (tested on m1vm)

 ERROR

Something went wrong installing the "sharp" module

Cannot find module '../build/Release/sharp.node'

- Remove the "node_modules/sharp" directory, run "npm install" and look for errors
- Consult the installation documentation at https://sharp.pixelplumbing.com/en/stable/install/
- Search for this error at https://github.com/lovell/sharp/issues

Luckily I had the same issue with sharp when building my own blog :) I essentially had to add libvips to my buildInputs. See here

butlerx commented 4 years ago

i was able to replicate this error on my local machine, and it was fixed by updating the dependencies.

butlerx commented 4 years ago

success open and validate gatsby-configs - 0.094s
⠋ load plugins

 ERROR 

Something went wrong installing the "sharp" module

Cannot find module '../build/Release/sharp.node'

- Remove the "node_modules/sharp" directory, run "npm install" and look for errors
- Consult the installation documentation at https://sharp.pixelplumbing.com/en/stable/install/
- Search for this error at https://github.com/lovell/sharp/issues

⠋ load plugins
⠋ load plugins

 ERROR 

┌───────────────────────────────────────────────────────────────┐
│                gatsby-cli update check failed                 │
│              Try running with sudo or get access              │
│             to the local update config store via              │
│ sudo chown -R $USER:$(id -gn $USER) /homeless-shelter/.config │
└───────────────────────────────────────────────────────────────┘

⠋ load plugins
⠋ load plugins
⠋ load plugins
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
builder for '/nix/store/br8lg746bq5dk10pqsid1v0zcim4gl13-react-site.drv' failed with exit code 1
cannot build derivation '/nix/store/i82s6f5iazx0lcc0nyp3hjgcsjcz610z-httpd.conf.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/yiygyfqyclna99hqp1qmdp9lbwqwzfad-etc.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/g7ifbgijnzn3jnry6jx8s1cl3gjswpsw-nixos-system-butlerxvm-20.09pre223023.fce7562cf46.drv': 1 dependencies couldn't be built
error: build of '/nix/store/g7ifbgijnzn3jnry6jx8s1cl3gjswpsw-nixos-system-butlerxvm-20.09pre223023.fce7562cf46.drv' failed```
butlerx commented 4 years ago

decided to move the build into a systemd service for 2 reasons:

  1. need network access at build time.
  2. be able to rebuild on a cron to pull in up to date content from google sheet for react-site#22

issue running yarn though


systemctl status react-site-build.service 
● react-site-build.service
     Loaded: loaded (/nix/store/x53c8z6z6gmnqc8ykhyfjmncjs95qwi4-unit-react-site-build.service/react-site-build.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2020-05-08 10:28:15 IST; 2min 9s ago
TriggeredBy: ● react-site-build.timer
    Process: 8480 ExecStart=/nix/store/90wjw3aqrada5042bsghq43fxb7w0zgq-unit-script-react-site-build-start (code=exited, status=1/FAILURE)
   Main PID: 8480 (code=exited, status=1/FAILURE)
         IP: 0B in, 0B out
        CPU: 1.318s

May 08 10:28:14 butlerxvm systemd[1]: Starting react-site-build.service...
May 08 10:28:15 butlerxvm 90wjw3aqrada5042bsghq43fxb7w0zgq-unit-script-react-site-build-start[8489]: yarn run v1.22.4
May 08 10:28:15 butlerxvm 90wjw3aqrada5042bsghq43fxb7w0zgq-unit-script-react-site-build-start[8489]: warning Skipping preferred cache folder "/var/empty/.cache/yarn" because it is not writabl>
May 08 10:28:15 butlerxvm 90wjw3aqrada5042bsghq43fxb7w0zgq-unit-script-react-site-build-start[8489]: warning Selected the next writable cache folder in the list, will be "/tmp/.yarn-cache-54".
May 08 10:28:15 butlerxvm 90wjw3aqrada5042bsghq43fxb7w0zgq-unit-script-react-site-build-start[8489]: error Couldn't find a package.json file in "/"
May 08 10:28:15 butlerxvm 90wjw3aqrada5042bsghq43fxb7w0zgq-unit-script-react-site-build-start[8489]: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
May 08 10:28:15 butlerxvm systemd[1]: react-site-build.service: Main process exited, code=exited, status=1/FAILURE
May 08 10:28:15 butlerxvm systemd[1]: react-site-build.service: Failed with result 'exit-code'.
May 08 10:28:15 butlerxvm systemd[1]: Failed to start react-site-build.service.
May 08 10:28:15 butlerxvm systemd[1]: react-site-build.service: Consumed 1.318s CPU time, no IP traffic.```