magjac/graphviz-visual-editor

Unable to create generated files using make with parallel job execution

Closed this issue · 3 comments

Steps to reproduce:

  1. Clone repo
  2. npm install
  3. make
  4. npm run build
Failed to compile.

Module parse failed: Cannot parse JSON: Unexpected token "c" (0x63) in JSON at position 0 while parsing near "const graphvizVersio..."
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
Error: Cannot parse JSON: Unexpected token "c" (0x63) in JSON at position 0 while parsing near "const graphvizVersio..."
  1. npm run start
Failed to compile.

Module parse failed: Cannot parse JSON: Unexpected token "c" (0x63) in JSON at position 0 while parsing near "const graphvizVersio..."
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
Error: Cannot parse JSON: Unexpected token "c" (0x63) in JSON at position 0 while parsing near "const graphvizVersio..."
ERROR in ./src/graphviz-versions.json
Module parse failed: Cannot parse JSON: Unexpected token "c" (0x63) in JSON at position 0 while parsing near "const graphvizVersio..."
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
Error: Cannot parse JSON: Unexpected token "c" (0x63) in JSON at position 0 while parsing near "const graphvizVersio..."
    at JsonParser.parse (graphviz-visual-editor/node_modules/webpack/lib/json/JsonParser.js:54:10)
    at graphviz-visual-editor/node_modules/webpack/lib/NormalModule.js:1235:19
    at processResult (graphviz-visual-editor/node_modules/webpack/lib/NormalModule.js:883:11)
    at graphviz-visual-editor/node_modules/webpack/lib/NormalModule.js:966:5
    at graphviz-visual-editor/node_modules/loader-runner/lib/LoaderRunner.js:407:3
    at iterateNormalLoaders (graphviz-visual-editor/node_modules/loader-runner/lib/LoaderRunner.js:233:10)
    at graphviz-visual-editor/node_modules/loader-runner/lib/LoaderRunner.js:224:4
    at graphviz-visual-editor/node_modules/webpack/lib/NormalModule.js:920:15
    at Array.eval (eval at create (graphviz-visual-editor/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:12:1)
    at runCallbacks (graphviz-visual-editor/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:45:15)
    at graphviz-visual-editor/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:279:5
    at graphviz-visual-editor/node_modules/graceful-fs/graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)

webpack compiled with 1 error

First lines of an src/graphviz-versions.json:

const graphvizVersion = "11.0.0";
export {graphvizVersion};
standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
 "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 11.0.0 (0)
 -->
<!-- Pages: 1 -->
<svg width="62pt" height="44pt"
 viewBox="0.00 0.00 62.00 44.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 40)">
<polygon fill="white" stroke="none" points="-4,4 -4,-40 58,-40 58,4 -4,4"/>
<!-- box -->
<g id="node1" class="node">
<title>box</title>
<polygon fill="lightgrey" stroke="black" points="54,-36 0,-36 0,0 54,0 54,-36"/>
</g>
</g>
</svg>
`,
polygon: `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
 "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 11.0.0 (0)

Checking out for a 1.2.0 release makes no changes

I cannot reproduce this on Ubuntu 24.04 with GNU Make 4.3, node v18.19.1 and npm 8.19.4. What environment do you have?

If you provide the output from the make step I might be able to figure out what went wrong.

Environment:
ArchLinux on Linux 6.8.1
GNU Make 4.4.1
node v20.18.0
npm 10.9.0

Compiles only with make -j1
Otherwise:

Full output of a make after npm install on fresh-cloned repo:

bin/generate-graphviz-version.js > tmp.js
git clone --depth 1 https://gitlab.com/graphviz/graphviz.git
bin/generate-nodes.js > tmp.js
bin/generate-versions.py CHANGELOG.md > tmp.js
./node_modules/markdown-to-html/bin/github-markdown README.md -h >readme.html
./node_modules/markdown-to-html/bin/github-markdown CHANGELOG.md -h >changelog.html
Cloning into 'graphviz'...
node_modules/.bin/peggy --format es --output tmp.js src/dotGrammar.pegjs
find graphviz -name '*.dot' | egrep -v "(nullderefrebuildlist\.dot|^graphviz/tests/.*)$" > dotfiles.txt
egrep: warning: egrep is obsolescent; using grep -E
make: *** [Makefile:46: dotfiles.txt] Error 1
make: *** Waiting for unfinished jobs....
mv tmp.js src/versions.json
(node:468295) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/nikto_b/graphviz-visual-editor/node_modules/markdown-to-html/package.json' of 'markdown.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:468296) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/nikto_b/graphviz-visual-editor/node_modules/markdown-to-html/package.json' of 'markdown.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
mv tmp.js src/graphvizVersion.js
mv: cannot stat 'tmp.js': No such file or directory
make: *** [Makefile:20: src/graphvizVersion.js] Error 1
echo "/* eslint-disable */" | cat - tmp.js > tmp2.js
mv tmp2.js src/dotParser.js
rm tmp.js
mv tmp.js src/shapes.js
mv: cannot stat 'tmp.js': No such file or directory
make: *** [Makefile:16: src/shapes.js] Error 1
remote: Enumerating objects: 3169, done.
remote: Counting objects: 100% (3169/3169), done.
remote: Compressing objects: 100% (2451/2451), done.
remote: Total 3169 (delta 987), reused 1836 (delta 664), pack-reused 0 (from 0)
Receiving objects: 100% (3169/3169), 27.39 MiB | 12.15 MiB/s, done.
Resolving deltas: 100% (987/987), done.

So, looks like this issue is resolved, just use make -j1
Issue was caused by global env MAKEFLAGS=-j8

Thanks. Actually, I think that using -j8 should work so I'm reopening this issue. I think I understand what the problem is now.