Lattyware/massivedecks

Errors while publishing on Ubuntu 18.04

mukberty opened this issue · 2 comments

When I run npm run dev in the client and server directories, it works perfectly.
Then I ran npm run generate-secret in the server and updated the secret: value in config.json5
When I ran npm run build in the server directory, it outputted
> @massivedecks/server@2.0.0 build /home/user/massivedecks/server
> npx tsc

I ran the same in the client directory,

> @massivedecks/client@2.0.0 prebuild /home/user/massivedecks/client
> sed -i "s/\"dev\"/\"${MD_VERSION:-${SOURCE_VERSION:-unknown}-dev}\"/g" src/elm/MassiveDecks/Version.elm


> @massivedecks/client@2.0.0 build /home/user/massivedecks/client
> npx webpack --mode=production

undefined:1



SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at ChildProcess.<anonymous> (/home/user/massivedecks/client/node_modules/closure-webpack-plugin/src/closure-compiler-plugin.js:1044:34)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1048:16)
    at Socket.<anonymous> (internal/child_process.js:439:11)
    at Socket.emit (events.js:315:20)
    at Pipe.<anonymous> (net.js:673:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @massivedecks/client@2.0.0 build: `npx webpack --mode=production`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @massivedecks/client@2.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/user/.npm/_logs/2020-11-11T05_15_09_148Z-debug.log

Then, in server:

node --es-module-specifier-resolution=node index.js
internal/process/esm_loader.js:74
    internalBinding('errors').triggerUncaughtException(
                              ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/user/massivedecks/server/index.js' imported from /home/user/massivedecks/server/
    at finalizeResolution (internal/modules/esm/resolve.js:265:11)
    at moduleResolve (internal/modules/esm/resolve.js:699:10)
    at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:810:11)
    at Loader.resolve (internal/modules/esm/loader.js:85:40)
    at Loader.getModuleJob (internal/modules/esm/loader.js:229:28)
    at Loader.import (internal/modules/esm/loader.js:164:28)
    at internal/modules/run_main.js:46:28
    at Object.loadESM (internal/process/esm_loader.js:68:11) {
  code: 'ERR_MODULE_NOT_FOUND'
}

In server:

 npm run build node --es-module-specifier-resolution=node index.js

> @massivedecks/server@2.0.0 build /home/user/massivedecks/server
> npx tsc "node" "index.js"

error TS6231: Could not resolve the path 'node' with the extensions: '.ts', '.tsx', '.d.ts'.

error TS6504: File 'index.js' is a JavaScript file. Did you mean to enable the 'allowJs' option?


Found 2 errors.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @massivedecks/server@2.0.0 build: `npx tsc "node" "index.js"`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the @massivedecks/server@2.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/user/.npm/_logs/2020-11-11T05_58_53_306Z-debug.log

In server/dist:

npm run build node --es-module-specifier-resolution=node index.js

> @massivedecks/server@2.0.0 build /home/user/massivedecks/server
> npx tsc "node" "index.js"

error TS6231: Could not resolve the path 'node' with the extensions: '.ts', '.tsx', '.d.ts'.

error TS6504: File 'index.js' is a JavaScript file. Did you mean to enable the 'allowJs' option?


Found 2 errors.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @massivedecks/server@2.0.0 build: `npx tsc "node" "index.js"`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the @massivedecks/server@2.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/user/.npm/_logs/2020-11-11T05_59_28_464Z-debug.log

/home/user/.npm/_logs/2020-11-11T05_59_28_464Z-debug.log and /home/user/.npm/_logs/2020-11-11T05_58_53_306Z-debug.log :

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run',
1 verbose cli   'build',
1 verbose cli   'node',
1 verbose cli   '--es-module-specifier-resolution=node',
1 verbose cli   'index.js'
1 verbose cli ]
2 info using npm@6.14.8
3 info using node@v14.15.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle @massivedecks/server@2.0.0~prebuild: @massivedecks/server@2.0.0
6 info lifecycle @massivedecks/server@2.0.0~build: @massivedecks/server@2.0.0
7 verbose lifecycle @massivedecks/server@2.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle @massivedecks/server@2.0.0~build: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/user/massivedecks/server/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
9 verbose lifecycle @massivedecks/server@2.0.0~build: CWD: /home/user/massivedecks/server
10 silly lifecycle @massivedecks/server@2.0.0~build: Args: [ '-c', 'npx tsc "node" "index.js"' ]
11 silly lifecycle @massivedecks/server@2.0.0~build: Returned: code: 2  signal: null
12 info lifecycle @massivedecks/server@2.0.0~build: Failed to exec build script
13 verbose stack Error: @massivedecks/server@2.0.0 build: `npx tsc "node" "index.js"`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1048:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid @massivedecks/server@2.0.0
15 verbose cwd /home/user/massivedecks/server/dist
16 verbose Linux 5.4.0-52-generic
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build" "node" "--es-module-specifier-resolution=node" "index.js"
18 verbose node v14.15.0
19 verbose npm  v6.14.8
20 error code ELIFECYCLE
21 error errno 2
22 error @massivedecks/server@2.0.0 build: `npx tsc "node" "index.js"`
22 error Exit status 2
23 error Failed at the @massivedecks/server@2.0.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

I haven't setup or configured anything else.
What should I do ?

I suspect this was an issue with the closure compiler and your platform for some reason. In my most recent change I've stopped using it as the size benefits were marginal, especially after compression. Hopefully that should resolve this issue.

Closing this as I suspect it's fixed and no further update. Please open a new issue if it shows up again.