This article details how to install the Squarespace local development server on Ubuntu 14.04 LTS.
I recently took on a small project, some work on customizing Squarespace templates. In the course of doing this, I required the Squarespace local development server in order to quickly modify and test changes to the template. I use a VirtualBox VM I built some time ago using Vagrant, based on Ubuntu 14.04 LTS.
If you’ve encountered problems installing this program on the aforemention Linux distro, read on and follow these steps, as they ended up working for me very well!
After following the instructions on Squarespace’s official website (link above) you might have come across the following error:
$ npm install -g @squarespace/server @squarespace/server@1.0.7 copyrunscript /usr/lib/node_modules/.staging/@squarespace/server-b43b0a9f node scripts/copyfile.js build/distributions/local-developer/bin/run.bat darwin:build/distributions/local-developer/bin/osx-local-developer win32:build/distributions/local-developer/bin/win-local-developer.bat linux:build/distributions/local-developer/bin/linux-local-developer build/distributions/local-developer/bin/local-developer copying build/distributions/local-developer/bin/linux-local-developer to build/distributions/local-developer/bin/run.bat npm ERR! Linux 4.2.0-27-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "@squarespace/server" npm ERR! node v6.9.4 npm ERR! npm v3.10.10 npm ERR! path ../lib/node_modules/@squarespace/server/build/distributions/local-developer/bin/run.bat npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall symlink npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/@squarespace/server/build/distributions/local-developer/bin/run.bat' -> '/usr/bin/squarespace-server' npm ERR! at Error (native) npm ERR! { Error: EACCES: permission denied, symlink '../lib/node_modules/@squarespace/server/build/distributions/local-developer/bin/run.bat' -> '/usr/bin/squarespace-server' npm ERR! at Error (native) npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'symlink', npm ERR! path: '../lib/node_modules/@squarespace/server/build/distributions/local-developer/bin/run.bat', npm ERR! dest: '/usr/bin/squarespace-server' } npm ERR!
This may occur if you attempt to install the program as a user with insufficient permissions. Installing as root may resolve the problem, as well as providing the user NPM is running under with the required permissions.
However, even following that step might not end matters for you; the next error might come up:
$ sudo npm install -g @squarespace/server npm WARN lifecycle @squarespace/server@1.0.7~preinstall: cannot run in wd %s %s (wd=%s) @squarespace/server@1.0.7 npm run accept && node scripts/execif.js --exists=build npm run copyrunscript /usr/lib/node_modules/.staging/@squarespace/server-b43b0a9f npm ERR! Linux 4.2.0-27-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "@squarespace/server" npm ERR! node v6.9.4 npm ERR! npm v3.10.10 npm ERR! path /usr/lib/node_modules/@squarespace/server/build/distributions/local-developer/bin/run.bat npm ERR! code ENOENT npm ERR! errno -2 npm ERR! syscall chmod npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/lib/node_modules/@squarespace/server/build/distributions/local-developer/bin/run.bat' npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/lib/node_modules/@squarespace/server/build/distributions/local-developer/bin/run.bat' npm ERR! enoent This is most likely not a problem with npm itself npm ERR! enoent and is related to npm not being able to find a file. npm ERR! enoent
The error messages may seem a bit opaque, but it appears that a required folder either wasn’t created or found during the installation process.
Installing squarespace-server for a specific project is easy enough, just omit the global flag (-g) when you install it to your site template’s project directory. The part that might be tricky for some is “moving” the files over, as it involves not only moving the files over to a new directory, but applying permissions and creating a symbolic link as well. The presence of the symbolic link is what will allow us to launch squarespace-server globally. The steps are as follows:
$ npm install @squarespace/server
$ sudo cp -rp node_modules/@squarespace /usr/lib/node_modules/
$ sudo chown -R vagrant:root @squarespace $ sudo chmod -R 755 @squarespace
$ sudo ln -s /usr/lib/node_modules/@squarespace/server/build/distributions/local-developer/bin/run.bat /usr/bin/squarespace-server
You should now be able to use the local development server, from inside your site’s ‘template’ directory:
$ squarespace-server https://[sitename].squarespace.com --auth
Hopefully this solution works for you. Share in the comments if this helped you get squarespace-server running!
Return homeTags: