Загрузка...

Compile in exe along with html

Thread in Node.js created by E11EVENTH Dec 19, 2022. 245 views

  1. E11EVENTH
    E11EVENTH Topic starter Dec 19, 2022 22 Dec 31, 2018
    Как скомпилировать ноду в ехе вместе с html? Сервер запускает сайт, через node script.js работает, если скомпилировать pkg script.js то когда заходишь на сайт пишет что html не добавлен в exe
     
  2. cardholder
    cardholder Dec 23, 2022 Banned 2448 Jul 13, 2022
    воспользуйся electron'ом
     
    1. View previous comments (5)
    2. cardholder
      E11EVENTH, я думаю проблема в самом компиляторе, потому что он просто не учитывает html
    3. E11EVENTH Topic starter
      cardholder, ну я в нём этого pkg полазил, там так, отдаленно намекают что и как, но прямого объяснения что и где прописать нету :/
  3. Мультичел
    Мультичел Dec 25, 2022 Banned 10,533 Aug 18, 2022
    To compile a Node.js script into an EXE file, you can use a tool like pkg. pkg is a command-line tool that can be used to create standalone executables from Node.js scripts.

    Here is an example of how you can use pkg to compile a Node.js script into an EXE file:


    Install pkg by running the following command:

    Code
    npm install -g pkg
    Create a Node.js script that you want to compile into an EXE file.
    Compile the script into an EXE file using pkg. For example:

    Code
    pkg script.js
    This will create an EXE file called "script.exe" that includes the Node.js script. When you run the EXE file, it will execute the Node.js script.

    Note that pkg can only include static files like HTML, CSS, and JavaScript in the EXE file. If you need to include other types of files (e.g. images, audio, etc.), you will need to use a different approach. One option is to use a tool like electron-packager, which can package a Node.js app into a standalone executable that includes all necessary files.
     
    1. E11EVENTH Topic starter
      Мультичел, ну вот последний абзац, я понимаю что может быть добавлены статические файлы, но как?
Loading...
Top