Software development is hard. Don’t let anyone tell you it’s easy.

For new developers getting started learning their first programming language and software development in general, it’s common to find it difficult to get started. It’s also common to struggle to get beyond the point of the simplest ‘hello world’ app, because building anything more than this requires significantly more understanding of key concepts, like boolean logic and iteration.

I see too many posts shared online where new developers are asking how can they get started quickly, or questioning how long it takes to develop skills to some level of competence. What these new developers tend to have not realized yet is that learning a programming language, learning tools and frameworks, learning software development in general is not a finite activity. There is no definite answer to these questions, because you will always be learning something new throughout your career, and you need to make a conscious and ongoing effort to make sure you keep your skills upto date and relevant.

At it’s core, there is no escaping the fact that software development is a complex and difficult activity. It requires a combination of many skills, from understanding a problem, finding effective solutions to a problem, and implementing a solution by converting concepts into instructions that can be executed by a computer. Learning a programming language is just one small part of this, but the process and speed that a developer can learn a language can vary dramatically – it could take a few months to a couple of years, at least to get to a point where you can comfortably use the features of the language to implement a solution. It doesn’t stop there though, at this point you have an understanding of the bare minimum, because software development as part of a team usually involves a much larger ecosystem of supporting tools, like issue trackers, version control, build and deploy tools, and runtime platforms.

If you are just starting out and are intimidated by the seemingly impossible task to learn how to develop software, stick with it. It will take a commitment of time to build up your skills and experience – you need to be thinking in terms of months to 1 to 2 years. If you’re looking at this and thinking this is something you can pick up in a couple of weeks, that’s completely unrealistic and it’s not going to happen. As long as you are dedicated and committed to learning, and have enough time and realize that it will take time, you will get there.

GitHub Action running npm build fails on warnings

On a new GitHub Action I’ve added on a React project, the npm run build is failing because apparently GitHib Actions treat warnings as errors:

Treating warnings as errors because process.env.CI = true.
Most CI servers set it automatically.

Failed to compile.

Following advice on questions to this post, adding CI=false to the ‘npm run build’ script in package.json turns off this behavior:

    "predeploy": "CI=false && npm run build",

GitHub Action npm i fails when package.json includes fsevents

I’ve added a GitHub Action to a project, and when it runs on a push I get this error:

Run npm ci
npm ERR! notsup Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin"} (current: {"os":"linux","arch":"x64"})
npm ERR! notsup Valid OS:    darwin
npm ERR! notsup Valid Arch:  undefined
npm ERR! notsup Actual OS:   linux
npm ERR! notsup Actual Arch: x64

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2022-09-11T23_52_20_527Z-debug-0.log
Error: Process completed with exit code 1.

fsevents is installed/added when doing ‘npm i’ as a dependency when building on MacOS, but it is MacOS specific, and since it’s included in my package.json it’s causing the build on GitHub to fail. Apparently according to this post, it can be optionally included on platforms where it’s available/needed by moving it from the dependencies section in package.json to optionalDependencies instead:

  "optionalDependencies": {
    "fsevents": "^2.3.2"

This resolved my issue, my GitHub Action now runs.

Free hosting for React apps: GitHub Pages and gh-pages

I work primarily with AWS and so my first choice for deployment of personal React projects is either a public S3 bucket with Static Website Hosting option enabled, or CloudFront with an S3 origin.

While costs for a site with low traffic will typically cost you < $1 a month with these options, there’s other options available that can be used for personal projects for free. Many of these are covered in this LogRocket article. If you’re already using GitHub, using GitHub Pages to host a React app is pretty easy with the gh-pages utility.

Assuming you have an exising React project, add gh-pages to your app:

npm i --save-dev gh-pages

Edit your package.json and add a couple of scripts:

    "predeploy": "npm run build",
    "deploy": "gh-pages -d build",

When you run ‘npm run deploy’ predeploy will run first to build your prod app, and then upload it to the remote origin for your git project. Note – this util assumes your GitHub remote repo is called origin, and it will fail with this error if it is called something else:

Failed to get remote.origin.url (task must either be run in a git repository with a configured origin remote or must be configured with the "repo" option).

If you name your remote GitHub repo something else, just add it again with the name origin ‘git remote add origin remote-repo-url’

When gh-pages runs, it uploads the built React app from ./build to a new branch on your repo called gh-pages. If you check the settings for your project, you should see the GitHub Pages settings for your app is configured to use this branch as it’s source:

If it’s using another branch change it to use gh-pages. Hit the url shown in the settings above to load your app from GitHub Pages!