mb21 / panwriter

Markdown editor with pandoc integration and paginated preview.
https://PanWriter.com
GNU General Public License v3.0
1.04k stars 51 forks source link

Does not compile #133

Closed Skeeve closed 1 year ago

Skeeve commented 1 year ago

Hi. In order to try to contribute, I created a Dockerfile.

Since it didn't work with Alpine Linux, I switched to Debian and had to go through a lot of hoops just to get it to a successfull yarn dist

FROM debian

ARG REPOSITORY
ENV REPOSITORY=${REPOSITORY:-https://github.com/mb21/panwriter.git}

WORKDIR /home/panwriter

RUN apt-get update -y \
 && apt-get install -y \
    git \
    curl \
    gnupg2 \
;
# We seem to require the newest nodejs
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
# Also a newer yarn is required
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
 && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
# Install it
RUN apt-get update -y  \
 && apt-get install -y \
    yarn

# Now clone the repository
RUN git clone $REPOSITORY
# And prepare
RUN cd panwriter \
 && yarn \
 && yarn install \
 && yarn dist

Unfortunately I'm a bit stuck with the dev mode as it produces a lot of warnings:

Long log ```text 1:56:07 PM - Starting compilation in watch mode... [1] [0] Compiled with warnings. [0] [0] Failed to parse source map from '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/gridtables/GetCells.ts' file: Error: ENOENT: no such file or directory, open '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/gridtables/GetCells.ts' [0] [0] Failed to parse source map from '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/gridtables/GetColumnWidths.ts' file: Error: ENOENT: no such file or directory, open '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/gridtables/GetColumnWidths.ts' [0] [0] Failed to parse source map from '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/markdown-it/ColumnAlignments.ts' file: Error: ENOENT: no such file or directory, open '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/markdown-it/ColumnAlignments.ts' [0] [0] Failed to parse source map from '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/markdown-it/EmitTable.ts' file: Error: ENOENT: no such file or directory, open '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/markdown-it/EmitTable.ts' [0] [0] Failed to parse source map from '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/markdown-it/GetCharCodeAtStartOfLine.ts' file: Error: ENOENT: no such file or directory, open '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/markdown-it/GetCharCodeAtStartOfLine.ts' [0] [0] Failed to parse source map from '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/markdown-it/GetLine.ts' file: Error: ENOENT: no such file or directory, open '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/markdown-it/GetLine.ts' [0] [0] Failed to parse source map from '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/markdown-it/ParseTable.ts' file: Error: ENOENT: no such file or directory, open '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/markdown-it/ParseTable.ts' [0] [0] Failed to parse source map from '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/markdown-it/ParseTableResult.ts' file: Error: ENOENT: no such file or directory, open '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/markdown-it/ParseTableResult.ts' [0] [0] Failed to parse source map from '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/index.ts' file: Error: ENOENT: no such file or directory, open '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/index.ts' [0] [0] Failed to parse source map from '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/rules/gridtable.ts' file: Error: ENOENT: no such file or directory, open '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/rules/gridtable.ts' [0] [0] Search for the keywords to learn more about each warning. [0] To ignore, add // eslint-disable-next-line to the line before. [0] [0] assets by status 6.63 KiB [cached] 11 assets [0] assets by status 4.12 MiB [emitted] [0] assets by chunk 4.12 MiB (name: main) [0] asset static/js/bundle.js 4.12 MiB [emitted] (name: main) 1 related asset [0] asset main.8f73fa6cec270f594381.hot-update.js 360 bytes [emitted] [immutable] [hmr] (name: main) 1 related asset [0] assets by path *.json 1.41 KiB [0] asset asset-manifest.json 1.38 KiB [emitted] [0] asset main.8f73fa6cec270f594381.hot-update.json 28 bytes [emitted] [immutable] [hmr] [0] asset index.html 483 bytes [emitted] [0] Entrypoint main 4.12 MiB (4 MiB) = static/js/bundle.js 4.12 MiB main.8f73fa6cec270f594381.hot-update.js 360 bytes 13 auxiliary assets [0] cached modules 3.58 MiB (javascript) 3.04 KiB (asset) [cached] 641 modules [0] runtime modules 28.3 KiB 14 modules [0] [0] WARNING in ./node_modules/markdown-it-gridtables/dist/common/gridtables/GetCells.js [0] Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): [0] Failed to parse source map from '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/gridtables/GetCells.ts' file: Error: ENOENT: no such file or directory, open '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/gridtables/GetCells.ts' [0] @ ./node_modules/markdown-it-gridtables/dist/common/markdown-it/EmitTable.js 13:19-52 [0] @ ./node_modules/markdown-it-gridtables/dist/rules/gridtable.js 11:20-62 [0] @ ./node_modules/markdown-it-gridtables/dist/index.js 11:20-48 [0] @ ./node_modules/markdown-it-pandoc/index.js 62:21-62 [0] @ ./src/renderPreview/convertMd.ts 4:0-50 5:19-35 [0] @ ./src/renderPreview/renderPreview.ts 3:0-40 52:13-22 [0] @ ./src/components/App/App.tsx 13:0-66 27:6-19 [0] @ ./src/index.tsx 8:0-43 22:34-37 [0] [0] WARNING in ./node_modules/markdown-it-gridtables/dist/common/gridtables/GetColumnWidths.js [0] Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): [0] Failed to parse source map from '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/gridtables/GetColumnWidths.ts' file: Error: ENOENT: no such file or directory, open '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/gridtables/GetColumnWidths.ts' [0] @ ./node_modules/markdown-it-gridtables/dist/common/markdown-it/ParseTable.js 15:26-66 [0] @ ./node_modules/markdown-it-gridtables/dist/rules/gridtable.js 15:21-64 [0] @ ./node_modules/markdown-it-gridtables/dist/index.js 11:20-48 [0] @ ./node_modules/markdown-it-pandoc/index.js 62:21-62 [0] @ ./src/renderPreview/convertMd.ts 4:0-50 5:19-35 [0] @ ./src/renderPreview/renderPreview.ts 3:0-40 52:13-22 [0] @ ./src/components/App/App.tsx 13:0-66 27:6-19 [0] @ ./src/index.tsx 8:0-43 22:34-37 [0] [0] WARNING in ./node_modules/markdown-it-gridtables/dist/common/markdown-it/ColumnAlignments.js [0] Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): [0] Failed to parse source map from '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/markdown-it/ColumnAlignments.ts' file: Error: ENOENT: no such file or directory, open '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/markdown-it/ColumnAlignments.ts' [0] @ ./node_modules/markdown-it-gridtables/dist/common/markdown-it/EmitTable.js 11:27-56 [0] @ ./node_modules/markdown-it-gridtables/dist/rules/gridtable.js 11:20-62 [0] @ ./node_modules/markdown-it-gridtables/dist/index.js 11:20-48 [0] @ ./node_modules/markdown-it-pandoc/index.js 62:21-62 [0] @ ./src/renderPreview/convertMd.ts 4:0-50 5:19-35 [0] @ ./src/renderPreview/renderPreview.ts 3:0-40 52:13-22 [0] @ ./src/components/App/App.tsx 13:0-66 27:6-19 [0] @ ./src/index.tsx 8:0-43 22:34-37 [0] [0] WARNING in ./node_modules/markdown-it-gridtables/dist/common/markdown-it/EmitTable.js [0] Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): [0] Failed to parse source map from '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/markdown-it/EmitTable.ts' file: Error: ENOENT: no such file or directory, open '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/markdown-it/EmitTable.ts' [0] @ ./node_modules/markdown-it-gridtables/dist/rules/gridtable.js 11:20-62 [0] @ ./node_modules/markdown-it-gridtables/dist/index.js 11:20-48 [0] @ ./node_modules/markdown-it-pandoc/index.js 62:21-62 [0] @ ./src/renderPreview/convertMd.ts 4:0-50 5:19-35 [0] @ ./src/renderPreview/renderPreview.ts 3:0-40 52:13-22 [0] @ ./src/components/App/App.tsx 13:0-66 27:6-19 [0] @ ./src/index.tsx 8:0-43 22:34-37 [0] [0] WARNING in ./node_modules/markdown-it-gridtables/dist/common/markdown-it/GetCharCodeAtStartOfLine.js [0] Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): [0] Failed to parse source map from '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/markdown-it/GetCharCodeAtStartOfLine.ts' file: Error: ENOENT: no such file or directory, open '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/markdown-it/GetCharCodeAtStartOfLine.ts' [0] @ ./node_modules/markdown-it-gridtables/dist/rules/gridtable.js 13:35-92 [0] @ ./node_modules/markdown-it-gridtables/dist/index.js 11:20-48 [0] @ ./node_modules/markdown-it-pandoc/index.js 62:21-62 [0] @ ./src/renderPreview/convertMd.ts 4:0-50 5:19-35 [0] @ ./src/renderPreview/renderPreview.ts 3:0-40 52:13-22 [0] @ ./src/components/App/App.tsx 13:0-66 27:6-19 [0] @ ./src/index.tsx 8:0-43 22:34-37 [0] [0] WARNING in ./node_modules/markdown-it-gridtables/dist/common/markdown-it/GetLine.js [0] Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): [0] Failed to parse source map from '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/markdown-it/GetLine.ts' file: Error: ENOENT: no such file or directory, open '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/markdown-it/GetLine.ts' [0] @ ./node_modules/markdown-it-gridtables/dist/common/markdown-it/ParseTable.js 17:18-38 [0] @ ./node_modules/markdown-it-gridtables/dist/rules/gridtable.js 15:21-64 [0] @ ./node_modules/markdown-it-gridtables/dist/index.js 11:20-48 [0] @ ./node_modules/markdown-it-pandoc/index.js 62:21-62 [0] @ ./src/renderPreview/convertMd.ts 4:0-50 5:19-35 [0] @ ./src/renderPreview/renderPreview.ts 3:0-40 52:13-22 [0] @ ./src/components/App/App.tsx 13:0-66 27:6-19 [0] @ ./src/index.tsx 8:0-43 22:34-37 [0] [0] WARNING in ./node_modules/markdown-it-gridtables/dist/common/markdown-it/ParseTable.js [0] Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): [0] Failed to parse source map from '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/markdown-it/ParseTable.ts' file: Error: ENOENT: no such file or directory, open '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/markdown-it/ParseTable.ts' [0] @ ./node_modules/markdown-it-gridtables/dist/rules/gridtable.js 15:21-64 [0] @ ./node_modules/markdown-it-gridtables/dist/index.js 11:20-48 [0] @ ./node_modules/markdown-it-pandoc/index.js 62:21-62 [0] @ ./src/renderPreview/convertMd.ts 4:0-50 5:19-35 [0] @ ./src/renderPreview/renderPreview.ts 3:0-40 52:13-22 [0] @ ./src/components/App/App.tsx 13:0-66 27:6-19 [0] @ ./src/index.tsx 8:0-43 22:34-37 [0] [0] WARNING in ./node_modules/markdown-it-gridtables/dist/common/markdown-it/ParseTableResult.js [0] Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): [0] Failed to parse source map from '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/markdown-it/ParseTableResult.ts' file: Error: ENOENT: no such file or directory, open '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/common/markdown-it/ParseTableResult.ts' [0] @ ./node_modules/markdown-it-gridtables/dist/common/markdown-it/ParseTable.js 13:27-56 [0] @ ./node_modules/markdown-it-gridtables/dist/rules/gridtable.js 15:21-64 [0] @ ./node_modules/markdown-it-gridtables/dist/index.js 11:20-48 [0] @ ./node_modules/markdown-it-pandoc/index.js 62:21-62 [0] @ ./src/renderPreview/convertMd.ts 4:0-50 5:19-35 [0] @ ./src/renderPreview/renderPreview.ts 3:0-40 52:13-22 [0] @ ./src/components/App/App.tsx 13:0-66 27:6-19 [0] @ ./src/index.tsx 8:0-43 22:34-37 [0] [0] WARNING in ./node_modules/markdown-it-gridtables/dist/index.js [0] Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): [0] Failed to parse source map from '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/index.ts' file: Error: ENOENT: no such file or directory, open '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/index.ts' [0] @ ./node_modules/markdown-it-pandoc/index.js 62:21-62 [0] @ ./src/renderPreview/convertMd.ts 4:0-50 5:19-35 [0] @ ./src/renderPreview/renderPreview.ts 3:0-40 52:13-22 [0] @ ./src/components/App/App.tsx 13:0-66 27:6-19 [0] @ ./src/index.tsx 8:0-43 22:34-37 [0] [0] WARNING in ./node_modules/markdown-it-gridtables/dist/rules/gridtable.js [0] Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): [0] Failed to parse source map from '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/rules/gridtable.ts' file: Error: ENOENT: no such file or directory, open '/home/panwriter/panwriter/node_modules/markdown-it-gridtables/src/rules/gridtable.ts' [0] @ ./node_modules/markdown-it-gridtables/dist/index.js 11:20-48 [0] @ ./node_modules/markdown-it-pandoc/index.js 62:21-62 [0] @ ./src/renderPreview/convertMd.ts 4:0-50 5:19-35 [0] @ ./src/renderPreview/renderPreview.ts 3:0-40 52:13-22 [0] @ ./src/components/App/App.tsx 13:0-66 27:6-19 [0] @ ./src/index.tsx 8:0-43 22:34-37 [0] [0] 10 warnings have detailed information that is not shown. [0] Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it. [0] [0] webpack 5.65.0 compiled with 10 warnings in 1185 ms [0] No issues found. [1] [1] 1:56:17 PM - Found 0 errors. Watching for file changes. [2] /home/panwriter/panwriter/node_modules/electron/dist/electron: error while loading shared libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or directory [2] wait-on http://localhost:3000 && yarn run electron:tsc -p electron && ELECTRON_IS_DEV=1 electron . exited with code 127 ```

But what hinders me most is this error, when trying to build the ZIP file for my Mac. DMG does not work as the required module cannot be installed on debian.

Errors with `yarn run electron-builder -m zip` ```text root@fed5f3beb494:/home/panwriter# yarn run electron-builder -m zip yarn run v1.22.19 $ /home/panwriter/node_modules/.bin/electron-builder -m zip • electron-builder version=23.6.0 os=5.10.124-linuxkit • loaded configuration file=package.json ("build" field) • writing effective config file=dist/builder-effective-config.yaml • packaging platform=darwin arch=x64 electron=22.0.0 appOutDir=dist/mac-x64 • downloading url=https://github.com/electron/electron/releases/download/v22.0.0/electron-v22.0.0-darwin-x64.zip size=92 MB parts=8 • downloaded url=https://github.com/electron/electron/releases/download/v22.0.0/electron-v22.0.0-darwin-x64.zip duration=14.536s ⨯ Application entry file "build/electron/main.js" in the "/home/panwriter/dist/mac-x64/PanWriter.app/Contents/Resources/app.asar" does not exist. Seems like a wrong configuration. failedTask=build stackTrace=Error: Application entry file "build/electron/main.js" in the "/home/panwriter/dist/mac-x64/PanWriter.app/Contents/Resources/app.asar" does not exist. Seems like a wrong configuration. at error (/home/panwriter/node_modules/app-builder-lib/src/asar/asarFileChecker.ts:7:12) at Object.checkFileInArchive (/home/panwriter/node_modules/app-builder-lib/src/asar/asarFileChecker.ts:31:11) at MacPackager.checkFileInPackage (/home/panwriter/node_modules/app-builder-lib/src/platformPackager.ts:503:7) at MacPackager.sanityCheckPackage (/home/panwriter/node_modules/app-builder-lib/src/platformPackager.ts:551:5) at MacPackager.doPack (/home/panwriter/node_modules/app-builder-lib/src/platformPackager.ts:312:5) at MacPackager.pack (/home/panwriter/node_modules/app-builder-lib/src/macPackager.ts:192:7) at Packager.doBuild (/home/panwriter/node_modules/app-builder-lib/src/packager.ts:441:9) at Object.executeFinally (/home/panwriter/node_modules/builder-util/src/promise.ts:12:14) at Packager._build (/home/panwriter/node_modules/app-builder-lib/src/packager.ts:376:31) at Packager.build (/home/panwriter/node_modules/app-builder-lib/src/packager.ts:337:12) at Object.executeFinally (/home/panwriter/node_modules/builder-util/src/promise.ts:12:14) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. ```

How can I solve the missing main.js?

Skeeve commented 1 year ago

Maybe I got it.

Is this correct:

yarn run electron:build && yarn run electron-builder -m zip?

Skeeve commented 1 year ago

Okay… For anyone coming here due to similar issues:

  1. You need more recent version of yarn and nodejs than debian offers.
  2. If you want to create DMG you have to (it seems) use a Mac. Otherwise just create a zip (yarn dist -m zip)
  3. If you want to create Windows Installers you need wine, but haven't looked into it.
  4. You might want to use Docker to build panwriter.

If you want to use docker and my PR #135 isn't merged yet, check out my branch.