Skip to content

App build process

Tomasz Dziuda edited this page Feb 17, 2023 · 19 revisions

Required software

For app build you will need the following software installed:

  • node.js (16.*)
  • npm (>= 8.*)
  • python (>= 2.5.0 && < 3.0.0)
  • electron (in version used by Publii), electron-packager, node-gyp and gulp node.js modules installed globally

Only for Windows:

  • npm install --global --production windows-build-tools

Only for macOS:

  • Install XCode

Build process

  1. In the root project directory run:
npm install
cd app
npm install
cd ..
npm run dev
  1. When the files are compiled run:

(Since Publii 1.0.0):

npm run prepare-editor

(For Publii < 1.0.0):

gulp prepare-editor-css

Then create the app/dist/vendor catalog and copy the following catalogs to this newly created vendor catalog:

  • app/src/helpers/vendor/jquery
  • app/src/helpers/vendor/tinymce
  1. Now you can run the Publii app:
npm run build

Please remember to have running the dev command in the second terminal process:

npm run dev

keytar, sharp and node-expat node modules compilation

If you get errors regarding improper version of some node modules according to your node.js version, run the following command in the directory of these modules:

  • app/node_modules/keytar
  • app/node_modules/sharp
  • app/node_modules/better-sqlite3
node-gyp rebuild --target=ELECTRON_VERSION --arch=x64 --dist-url=https://electronjs.org/headers

ELECTRON_VERSION - replace with current version of the Electron used in the app.

Alternatively you can use electron-rebuild if installed globally under the app/ directory

Known issues

Not refresh the app in these views

  • Post editor

After refreshing the app under development mode in the above views, the app will crash.

Permission issues

If you have problems with the E_ACCESS, you can try to add in the npm commands the following params: --unsafe-perm=true --allow-root.