Landing page 2/2/2022
start gatsby dev server | gatsby develop |
build static site | gatsby build |
On your local machine:
gatsby build
make deploy-site
Notes:
- If you dont have
make
installed, ๐ macOS, Windows - Before running
$ make deploy-site
, make sure you have access to the ssh server and you have the eys configured and the /public folder is built in your project
If on Mac
npm install --global yarn
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn
sudo apt-get install libpng-dev
To minimize the chance of permissions errors, configure npm to use a different directory. This will show you how to create and use a hidden directory in your home directory.
On the command line in ~
, create a directory for global installations:
mkdir ~/.npm-global
Config npm to use the new dir path:
npm config set prefix '~/.npm-global'
In RHEL cloud vi open former else open latter
~/.bashrc
OR ~/.profile
file and upsert line:
export PATH=~/.npm-global/bin:$PATH
On the command line update those system variables:
source ~/.profile
Test your new config by installing a package globally without using sudo
Node gyp on mac Debug article
Node GYP Error on Apple Silicon Mac (Tried on M1 Mac) Debug Article
Assuming you are on Ubuntu AWS
Also reminder to
sudo apt-get install build-essential
Back up your computer. On the command line, in your home directory, create a directory for global installations:
mkdir ~/.npm-global
Configure npm to use the new directory path:
npm config set prefix '~/.npm-global'
If it's not already in your bashrc already, in your preferred text editor, open or create a ~/.bashrc
file (~/.bash_profile
on OSX) and add this line:
echo "export PATH=~/.npm-global/bin:$PATH" >> ~/.bashrc
On the command line, update your system variables:
source ~/.bashrc
To test your new configuration, install a package globally without using sudo:
npm install -g jshint
Will be needed.
npm install -g gatsby-cli
PROTIP: Don't forget to run
gatsby telemetry --disable
afterwards
If you haven't ran the code in a while
yarn upgrade
verified to resolve the issue on osx local dev
yarn add babel-preset-gatsby --dev
Remember to save dev
yarn
yarn build
Run with local http-server if staging
./node_modules/http-server/bin/http-server public/ -p 7000
if on local dev environemnt run
yarn start
npx http-server public/ -p 6000
Add pm2 and run with ./pm2 list
to test prior to production start
yarn add pm2
pm2 serve public/ 80
- Check with admin on Domain and AWS Route 53 configuration
- You'll need to run
yarn build
- Upload contents to the s3 bucket
- Invalidate Cache on Cloudfront on paths
/*
Assumptions: you are using yarn
and building locally
And you are getting an issue with the npm package sharp
The solution is contained here nuxt/image#204
Issue when installing NPM module sharp
- Remove hidden config file in home directory
rm -rf ~/.pm2
zsh: command not found: yarn
- Run
source ~/.profile