SharePoint Framework on Ubuntu Linux

I usually use a Windows 10 machine or MacBook Pro for SharePoint Framework development. However, I have always been a fan of Ubuntu Linux. I had just built a brand-new Ubuntu Desktop and wanted to use that for SharePoint Framework development. If you read the Microsoft documentation, it is straightforward but does not cater entirely for Ubuntu as much, especially if there are issues. This post will walk through the installation and setup of your first web part.

Once Ubuntu is installed, launch a “Terminal” window and run the following command:

Once this completes run the following command:

Now that “node” is installed, you can type “node,” and the terminal will drop into a node command.

Typing “node -v” will output the version to ensure you have the right one needed for SharePoint Framework Development.

Next, we need to install “npm,” “yo” and “gulp.” Firstly, “npm” is required so we can then establish the rest.

With “npm” installed, we can run the following command to add “yo” and “gulp.”

Next, we need to install the generator used to scaffold SharePoint Framework components using this command.

As you can see each one is run with “sudo” to ensure, there are no permission issues, which I encountered if not in “sudo” mode.

Now navigate to the location where you want to create the SharePoint Framework components, and create the folder structure using “mkdir,” then navigate into the structure as needed.

Now run the following command to generate the SharePoint Framework project.

You can now follow the standard SharePoint Framework wizard; this part may take some time as it scaffolds the project. It should complete successfully and create the new project.

Next, run “gulp serve” to run the workbench. As usual, the browser opens and displays the security message about the certificate, which we could fix, but for now, it will complain. At the complaint screen, add the exception and allow the site to continue loading.

If you get a timeout error, then you will need to make changes to the firewall rules to allow the specific port of “4321” open. Execute the following command, then retest “gulp serve.” To check the status first, you can run “sudo ufw status,” and if not enabled, then you do not need to run the following command.

You may have to kill the current “gulp serve” you have running and the current browser too. If this does not work, check the contents of the “/etc/hosts” file to ensure “localhost” is resolvable.

If this does not work, then try setting the “NODE_NO_HTTP2” property to “1” as part of the “gulp serve” command used to launch the workbench.

The workbench will now load as expected within Ubuntu.

And there you have it, working SharePoint Framework on Ubuntu 🙂

Liam Cleary

I began my career as a Trainer of all things computer related. However, I very quickly realized that programming, breaking, and hacking was a lot more fun. I then spent the next few years working on core infrastructure and security services, until I found SharePoint. I am now the founder and owner of SharePlicity, a consulting company that focuses on all areas of Technology. My role within SharePlicity is to help organizations implement technology that will enhance internal and external collaboration, document and records management, automate business processes and of course security controls and protection. I am also an eleven-time Microsoft MVP focusing on Architecture but also cross the boundary into Development. My specialty over the past few years has been security in SharePoint and its surrounding platforms. I can also be found at user groups or conferences speaking, offering advice, spending time in the community, teaching my kids how to code, raspberry PI programming, hacking the planet or building Lego robots.

You may also like...