979 просмотра
1 ответ
16644 Репутация автора
I’m trying to create my first package with nwjs, so I created a simple app with only nwjs module installed locally with npm. My app main file has only a console.log("Hello World!") . I zipped the app files — keeping them in the root — and renamed to app.nw . I basically followed this doc. The package tree is the following:
And my package.json is:
Then I created an empty folder and copied app.nw to it. From the module folder /nw/nwjs I copied the files: nw.exe , nw.dll , nw_elf.dll and ffmpeg.dll to it, and dragged app.nw over nw.exe . The debug.log file shows me the following error:
[0524/110408:ERROR:icu_util.cc(157)] Invalid file descriptor to ICU data received. [0524/110408:FATAL:icu_util.cc(260)] Check failed: result.
I can’t find anything related to this error and this tool over the web. I’m running it in a Win7 x64. I also tryied downloading nwjs manually from github and tryied with x64 and x86 binaries, but they all give me the same error.
У меня есть скрипт узла, который преобразует веб-страницу в документ PDF. Пользователь вводит некоторый контент, а PHP создает страницу HTML, которая затем используется в скрипте узла (который запускает Puppeteer, используя слегка измененную версию пример сценария ) преобразовать его в PDF.
Но когда я Exec в PHP команда для запуска скрипта узла завершается с ошибкой:
PHP работает с apache пользователь. Однако, если я запускаю тот же скрипт со своим пользователем, он работает отлично. Когда я выполняю в терминале, используя su — apache -c ‘node . ‘ это снова выдает ошибку, описанную выше.
Что является причиной ошибки? Что-то связано с разрешениями пользователя apache? Я следовал всем инструкциям по устранению неполадок, но в данный момент мне не повезло.
Решение
Кажется, проблема связана с разрешениями файловой системы для хрома по умолчанию, используемого кукловодом:
используя ACL (моя группа nginx www-data поменяй на свой на apache):
sudo setfacl -R -m g:www-data:rX node_modules/puppeteer/.local-chromium/
sudo setfacl -dR -m g:www-data:rX node_modules/puppeteer/.local-chromium/
после установки разрешений ошибка ушла.
Другие решения
Я использовал пакетную версию Chromium, которая поставляется вместе с библиотекой Puppeteer (как установлено с помощью npm install puppeteer ).
Вместо того, чтобы использовать эту версию, я попытался установить Chromium для всей системы и дать сценарию узла путь к общесистемной установке Chromium. Это наконец работает, эта версия не имеет такой странной проблемы!
Чтобы выполнить Puppeteer, используя другой исполняемый файл:
Я буду искать другие ответы, если есть другое решение вместо установки Chromium в системе.
I’m trying to create my first package with nwjs, so I created a simple app with only nwjs module installed locally with npm. My app main file has only a console.log("Hello World!") . I zipped the app files — keeping them in the root — and renamed to app.nw . I basically followed this doc. The package tree is the following:
And my package.json is:
Then I created an empty folder and copied app.nw to it. From the module folder /nw/nwjs I copied the files: nw.exe , nw.dll , nw_elf.dll and ffmpeg.dll to it, and dragged app.nw over nw.exe . The debug.log file shows me the following error:
[0524/110408:ERROR:icu_util.cc(157)] Invalid file descriptor to ICU data received. [0524/110408:FATAL:icu_util.cc(260)] Check failed: result.
I can’t find anything related to this error and this tool over the web. I’m running it in a Win7 x64. I also tryied downloading nwjs manually from github and tryied with x64 and x86 binaries, but they all give me the same error.