Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

chore: Relates to #309. Update to Electron v4.0.1 #352

Merged
merged 18 commits into from
Feb 4, 2019

Conversation

ltfschoen
Copy link
Contributor

No description provided.

@ltfschoen
Copy link
Contributor Author

ltfschoen commented Jan 10, 2019

So far I'm getting the following error when using Node.js 11.6.0 or 10.11.0 and electron 4.0.1

Error:

Error: Cannot find module '/Users/scon/code/src/paritytech/fether/node_modules/react-scripts/config/webpack.config.dev'

It appears to be due to this issue, which is awaiting a PR to be merged dilanx/craco#61

Attempts to fix:

Updated to 4.11.0 instead of 4.9.0 in fether-react package.json

  "dependencies": {
...
    "react-scripts": "^2.1.3",

"devDependencies": {
...
    "node-sass": "^4.11.0",
    "node-sass-chokidar": "^1.3.4",

Still get error:

error dump

error /Users/scon/code/src/paritytech/fether/node_modules/@parity/electron: Command failed.
Exit code: 1
Command: yarn build
Arguments: 
Directory: /Users/scon/code/src/paritytech/fether/node_modules/@parity/electron
Output:
yarn run v1.12.3

yarn run v1.12.3
$ npm-run-all -l -p start-*
[start-react ] $ cd packages/fether-react && yarn start
[start-electron] $ cd packages/fether-electron && yarn start
[start-ui ] $ cd packages/fether-ui && yarn start
[start-react ] $ npm-run-all -p start-*
[start-electron] $ cross-env ELECTRON_START_URL=http://localhost:3000 electron-webpack dev --ws-origins all
[start-ui ] $ yarn build --watch
[start-ui ] $ rimraf lib
[start-ui ] $ babel src --out-dir lib --watch
[start-react ] $ cross-env SKIP_PREFLIGHT_CHECK=true BROWSER=none craco start --react-scripts ../../node_modules/react-scripts
[start-react ] $ npm run build-css -- --watch --recursive
[start-react ] npm WARN lifecycle The node binary used for scripts is /var/folders/3l/g218pml13z9dln237br671wr0000gp/T/yarn--1547158359275-0.6547932397447758/node but npm is using /Users/scon/.nvm/versions/node/v10.11.0/bin/node itself. Use the --scripts-prepend-node-path option to include the path for the node binary npm was executed with.
[start-react ]
[start-react ] > [email protected] build-css /Users/scon/code/src/paritytech/fether/packages/fether-react
[start-react ] > node-sass-chokidar src/ -o src/ "--watch" "--recursive"
[start-react ]
[start-react ] internal/modules/cjs/loader.js:583
[start-react ] throw err;
[start-react ] ^
[start-react ]
[start-react ] Error: Cannot find module '/Users/scon/code/src/paritytech/fether/node_modules/react-scripts/config/webpack.config.dev'
[start-react ] at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
[start-react ] at Function.resolve (internal/modules/cjs/helpers.js:30:19)
[start-react ] at resolveConfigFilePath (/Users/scon/code/src/paritytech/fether/node_modules/@craco/craco/lib/cra.js:7:20)
[start-react ] at getWebpackDevConfigPath (/Users/scon/code/src/paritytech/fether/node_modules/@craco/craco/lib/cra.js:25:12)
[start-react ] at loadWebpackDevConfig (/Users/scon/code/src/paritytech/fether/node_modules/@craco/craco/lib/cra.js:29:22)
[start-react ] at Object. (/Users/scon/code/src/paritytech/fether/node_modules/@craco/craco/scripts/start.js:18:26)
[start-react ] at Module._compile (internal/modules/cjs/loader.js:689:30)
[start-react ] at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
[start-react ] at Module.load (internal/modules/cjs/loader.js:599:32)
[start-react ] at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
[start-react ] error Command failed with exit code 1.
[start-react ] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[start-react ] error Command failed with signal "SIGTERM".
[start-react ] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[start-react ] ERROR: "start-js" exited with 1.
[start-react ] error Command failed with exit code 1.
[start-react ] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[start-react ] error Command failed with exit code 1.
[start-react ] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[start-electron] error Command failed with signal "SIGTERM".
[start-electron] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[start-ui ] error Command failed with signal "SIGTERM".
[start-ui ] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "start-react" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@ltfschoen
Copy link
Contributor Author

ltfschoen commented Jan 11, 2019

I tried updating to the following in fether-react package.json, in light of this comment #336 (comment)

    "@parity/api": "^3.0.25",
    "@parity/contracts": "^3.0.25",
    "@parity/light.js": "^3.0.25",
    "@parity/light.js-react": "^3.0.25",

But it crashes with the following error, so to make it work I have to run export NPM_TOKEN=''; yarn; yarn start again:

error dump

error /Users/scon/code/src/paritytech/fether/node_modules/@parity/electron: Command failed.
Exit code: 1
Command: yarn build
Arguments: 
Directory: /Users/scon/code/src/paritytech/fether/node_modules/@parity/electron
Output:
yarn run v1.12.3
error An unexpected error occurred: "Failed to replace env in config: ${NPM_TOKEN}".
info If you think this is a bug, please open a bug report with the information provided in "/Users/scon/code/src/paritytech/fether/node_modules/@parity/electron/yarn-error.log".

yarn run v1.12.3
$ npm-run-all -l -p start-*
[start-react ] $ cd packages/fether-react && yarn start
[start-ui ] $ cd packages/fether-ui && yarn start
[start-electron] $ cd packages/fether-electron && yarn start
[start-ui ] $ yarn build --watch
[start-react ] $ npm-run-all -p start-*
[start-electron] $ cross-env ELECTRON_START_URL=http://localhost:3000 electron-webpack dev --ws-origins all
[start-ui ] $ rimraf lib
[start-ui ] $ babel src --out-dir lib --watch
[start-react ] $ cross-env SKIP_PREFLIGHT_CHECK=true BROWSER=none craco start --react-scripts ../../node_modules/react-scripts
[start-react ] $ npm run build-css -- --watch --recursive
[start-react ] internal/modules/cjs/loader.js:583
[start-react ] throw err;
[start-react ] ^
[start-react ]
[start-react ] Error: Cannot find module '/Users/scon/code/src/paritytech/fether/node_modules/react-scripts/config/webpack.config.dev'
[start-react ] at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
[start-react ] at Function.resolve (internal/modules/cjs/helpers.js:30:19)
[start-react ] at resolveConfigFilePath (/Users/scon/code/src/paritytech/fether/node_modules/@craco/craco/lib/cra.js:7:20)
[start-react ] at getWebpackDevConfigPath (/Users/scon/code/src/paritytech/fether/node_modules/@craco/craco/lib/cra.js:25:12)
[start-react ] at loadWebpackDevConfig (/Users/scon/code/src/paritytech/fether/node_modules/@craco/craco/lib/cra.js:29:22)
[start-react ] at Object. (/Users/scon/code/src/paritytech/fether/node_modules/@craco/craco/scripts/start.js:18:26)
[start-react ] at Module._compile (internal/modules/cjs/loader.js:689:30)
[start-react ] at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
[start-react ] at Module.load (internal/modules/cjs/loader.js:599:32)
[start-react ] at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
[start-react ] error Command failed with exit code 1.
[start-react ] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[start-react ] npm WARN lifecycle The node binary used for scripts is /var/folders/3l/g218pml13z9dln237br671wr0000gp/T/yarn--1547164774132-0.6564243733013317/node but npm is using /Users/scon/.nvm/versions/node/v10.11.0/bin/node itself. Use the --scripts-prepend-node-path option to include the path for the node binary npm was executed with.
[start-react ]
[start-react ] > [email protected] build-css /Users/scon/code/src/paritytech/fether/packages/fether-react
[start-react ] > node-sass-chokidar src/ -o src/ "--watch" "--recursive"
[start-react ]
[start-react ] error Command failed with signal "SIGTERM".
[start-react ] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[start-react ] => changed: /Users/scon/code/src/paritytech/fether/packages/fether-react/src/index.sass
[start-react ] Rendering Complete, saving .css file...
[start-react ] Wrote CSS to /Users/scon/code/src/paritytech/fether/packages/fether-react/src/index.css
[start-electron] ┏ Main -----------------------
[start-electron]
[start-electron] Hash: 38081c0d2c887897afe7
[start-electron] Version: webpack 4.12.1
[start-electron] Time: 1634ms
[start-electron] Built at: 01/11/2019 10:59:38 AM
[start-electron] Asset Size Chunks Chunk Names
[start-electron] main.js 94.6 KiB main [emitted] main
[start-electron] Entrypoint main = main.js
[start-electron] [./electron-builder.json] 346 bytes {main} [built]
[start-electron] [./node_modules/electron-webpack/out/electron-main-hmr/main-hmr.js] 562 bytes {main} [built]
[start-electron] [./package.json] 1.67 KiB {main} [built]
[start-electron] [./src/main/cli/index.js] 1.54 KiB {main} [built]
[start-electron] [./src/main/index.js] 4.05 KiB {main} [built]
[start-electron] [./src/main/menu/index.js] 2.09 KiB {main} [built]
[start-electron] [./src/main/messages/index.js] 1.13 KiB {main} [built]
[start-electron] [./src/main/utils/handleError.js] 1.03 KiB {main} [built]
[start-electron] [./src/main/utils/pino.js] 1.55 KiB {main} [built]
[start-electron] [./src/main/utils/staticPath.js] 434 bytes {main} [built]
[start-electron] [@parity/electron] external "@parity/electron" 42 bytes {main} [built]
[start-electron] [commander-remaining-args] external "commander-remaining-args" 42 bytes {main} [built]
[start-electron] [electron] external "electron" 42 bytes {main} [built]
[start-electron] [electron-webpack/out/electron-main-hmr/HmrClient] external "electron-webpack/out/electron-main-hmr/HmrClient" 42 bytes {main} [built]
[start-electron] [0] multi ./node_modules/electron-webpack/out/electron-main-hmr/main-hmr ./src/main/index.js 40 bytes {main} [built]
[start-electron] + 7 hidden modules
[start-electron]
[start-electron] ┗ ----------------------------
[start-electron] ┏ Electron -------------------
[start-electron]
[start-electron] Debugger listening on ws://127.0.0.1:5858/d11e3ea0-4d3c-4409-ba04-9ced27593166
[start-electron] For help, see: https://nodejs.org/en/docs/inspector
[start-electron]
[start-electron] ┗ ----------------------------
[start-ui ] 🎉 Successfully compiled 39 files with Babel.
[start-electron] ┏ Electron -------------------
[start-electron]
[start-electron] App threw an error during load
[start-electron]
[start-electron] ┗ ----------------------------
[start-electron] ┏ Electron -------------------
[start-electron]
[start-electron] Error: Cannot find module '@parity/electron'
[start-electron] at Module._resolveFilename (internal/modules/cjs/loader.js:584:15)
[start-electron] at Function.Module._resolveFilename (/Users/scon/code/src/paritytech/fether/node_modules/electron/dist/Electron.app/Contents/Resources/electron.asar/common/reset-search-paths.js:43:12)
[start-electron] at Function.Module._load (internal/modules/cjs/loader.js:510:25)
[start-electron] at Module.require (internal/modules/cjs/loader.js:640:17)
[start-electron] at require (internal/modules/cjs/helpers.js:20:18)
[start-electron] at eval (webpack-internal:///@parity/electron:1:18)
[start-electron] at Object.@parity/electron (/Users/scon/code/src/paritytech/fether/packages/fether-electron/dist/main/main.js:908:1)
[start-electron] at webpack_require (/Users/scon/code/src/paritytech/fether/packages/fether-electron/dist/main/main.js:698:30)
[start-electron] at fn (/Users/scon/code/src/paritytech/fether/packages/fether-electron/dist/main/main.js:75:20)
[start-electron] at eval (webpack-internal:///./src/main/index.js:2:74)
[start-electron]
[start-electron] ┗ ----------------------------


@amaury1093
Copy link
Collaborator

@ltfschoen Could you put code/console dumps into collapsible windows? To improve readability. Like this:

example

a

lot

of

lines


Alternatively, only paste the relevant lines.

@ltfschoen
Copy link
Contributor Author

ltfschoen commented Jan 12, 2019

@ltfschoen Could you put code/console dumps into collapsible windows? To improve readability. Like this:

example
a

lot

of

lines

Alternatively, only paste the relevant lines.

Sure, I found this useful for multi-line code snippets:

<details><p><pre>
INSERT MULTI-LINE
CODE SNIPPET
</pre></p></details><br />

See dilanx/craco#61.
Updating to craco 3.3.1 resolves error when trying to install dependencies and build:
```
Error: Cannot find module '~/code/src/paritytech/fether/node_modules/react-scripts/config/webpack.config.dev'
```
@ltfschoen
Copy link
Contributor Author

ltfschoen commented Jan 19, 2019

I've pushed commits (i.e. updating craco to 3.3.1) and it works now thanks to this issue having been resolved dilanx/craco#61 (comment).
I've tested it on Node.js 10.10.0, latest 11.7.0, and even 8.15.0, and it appears to work ok on all those versions.
However I've bumped the CI Node.js version to 10 and minimum version in package.json to 10.10.0 because in the Electron "Release Notes for v4.0.0" it says Bumped minimum supported macOS version to 10.10.

@ltfschoen ltfschoen changed the title WIP: Relates to #309. Update to Electron v4.0.1 chore: Relates to #309. Update to Electron v4.0.1 Jan 19, 2019
@amaury1093
Copy link
Collaborator

I just ran yarn install && yarn electron and got

Error: Cannot find module '/Users/amaurymartiny/Workspaces/fether/node_modules/react-scripts/config/webpack.config.prod'

Same thing with webpack.config.dev with yarn start. I think there's a version incompatibility between craco and react-scripts

@ltfschoen ltfschoen mentioned this pull request Jan 31, 2019
23 tasks
@ltfschoen
Copy link
Contributor Author

ltfschoen commented Feb 3, 2019

@amaurymartiny Could you please try running it again with yarn install && yarn electron.

I'm not sure what changed, but I just tried running it with both these combinations and it compiled successfully:

  • Node.js v11.7.0 and Yarn 1.10.1
  • Node.js v10.10.0 and Yarn 1.6.0

@amaury1093
Copy link
Collaborator

@ltfschoen Can you run a yarn install? yarn.lock should be updated and committed too.

@ltfschoen
Copy link
Contributor Author

@ltfschoen Can you run a yarn install? yarn.lock should be updated and committed too.

How embarrassing. Yes there are still issues that I'll have to figure out

I deleted yarn.lock and emptied node_modules (i.e. rm yarn.lock && rm -rf node_modules/), then ran yarn install and it compiled using Node.js v11.7.0 and Yarn 1.10.1.

I then ran yarn start but it gave error:

Failed to compile
./src/Accounts/AccountsList/AccountsList.js
Module not found: Can't resolve 'fether-ui' in '/Users/scon/code/src/paritytech/fether/packages/fether-react/src/Accounts/AccountsList'

I then ran yarn electron but it gave error:

scon @ ~/code/src/paritytech/fether - [luke-309-electron-4] $ yarn electron
yarn run v1.10.1
$ yarn build
$ lerna run build
lerna notice cli v3.10.7
lerna info Executing command in 3 packages: "yarn run build"
lerna ERR! yarn run build exited 1 in 'fether-ui'
lerna ERR! yarn run build stdout:
$ rimraf lib
$ babel src --out-dir lib
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

lerna ERR! yarn run build stderr:
{ Error: Cannot find module '@babel/plugin-proposal-class-properties' from '/Users/scon/code/src/paritytech/fether/packages/fether-ui'
    at Function.module.exports [as sync] (/Users/scon/code/src/paritytech/fether/node_modules/resolve/lib/sync.js:58:15)
    at resolveStandardizedName (/Users/scon/code/src/paritytech/fether/node_modules/@babel/core/lib/config/files/plugins.js:101:31)
    at resolvePlugin (/Users/scon/code/src/paritytech/fether/node_modules/@babel/core/lib/config/files/plugins.js:54:10)
    at loadPlugin (/Users/scon/code/src/paritytech/fether/node_modules/@babel/core/lib/config/files/plugins.js:62:20)
    at createDescriptor (/Users/scon/code/src/paritytech/fether/node_modules/@babel/core/lib/config/config-descriptors.js:154:9)
    at items.map (/Users/scon/code/src/paritytech/fether/node_modules/@babel/core/lib/config/config-descriptors.js:109:50)
    at Array.map (<anonymous>)
    at createDescriptors (/Users/scon/code/src/paritytech/fether/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)
    at createPluginDescriptors (/Users/scon/code/src/paritytech/fether/node_modules/@babel/core/lib/config/config-descriptors.js:105:10)
    at plugins (/Users/scon/code/src/paritytech/fether/node_modules/@babel/core/lib/config/config-descriptors.js:40:19) code: 'MODULE_NOT_FOUND' }
error Command failed with exit code 1.

lerna ERR! yarn run build exited 1 in 'fether-ui'
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@amaury1093
Copy link
Collaborator

@ltfschoen Can you try and remove this line and run the commands again? I think we don't need this plugin, it's inside stage-0 already.

@ltfschoen
Copy link
Contributor Author

ltfschoen commented Feb 4, 2019

this line

I think we should try updating to Babel 7.2.3 instead of 7.0.0-beta.49, where we don't use the stage-x presets anymore. What do you think? See https://babeljs.io/blog/2018/07/27/removing-babels-stage-presets. See the migrating section https://babeljs.io/blog/2018/07/27/removing-babels-stage-presets#migrating

@amaury1093
Copy link
Collaborator

Yes, you're correct. So either:

  • in this PR, yarn add --dev @babel/plugin-proposal-class-properties in fether-ui, and update babel in a future PR
  • or update babel in this PR directly

Both works for me, I'll let you choose

…el 7.2.3

Fixes errors:

```
{ Error: Cannot find module '@babel/plugin-proposal-class-properties' from '/Users/scon/code/src/paritytech/fether/packages/fether-ui'
```

```
Failed to minify the bundle. Error: static/js/main.f19a0eac.chunk.js from Terser
TypeError: Cannot read property 'minify' of undefined
```
@ltfschoen
Copy link
Contributor Author

@amaurymartiny I think it's ready to go now.

Before each check I ran rm yarn.lock && rm -rf node_modules/

Then I tested on Node.js v11.7.0 and Yarn 1.10.1 with yarn; yarn electron and yarn; yarn start, and also with the same on Node.js v10.10.0 and Yarn 1.6.0

In the Babel 7 migration guide these are the different plugings and
to add them:

See https://babeljs.io/blog/2018/07/27/removing-babels-stage-presets#migrating

```
// Stage 0
"@babel/plugin-proposal-function-bind",

// Stage 1
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-logical-assignment-operators",
["@babel/plugin-proposal-optional-chaining", { "loose": false }],
["@babel/plugin-proposal-pipeline-operator", { "proposal": "minimal" }],
["@babel/plugin-proposal-nullish-coalescing-operator", { "loose": false }],
"@babel/plugin-proposal-do-expressions",

// Stage 2
["@babel/plugin-proposal-decorators", { "legacy": true }],
"@babel/plugin-proposal-function-sent",
"@babel/plugin-proposal-export-namespace-from",
"@babel/plugin-proposal-numeric-separator",
"@babel/plugin-proposal-throw-expressions",

// Stage 3
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-syntax-import-meta",
["@babel/plugin-proposal-class-properties", { "loose": false }],
"@babel/plugin-proposal-json-strings"
```
@amaury1093 amaury1093 merged commit 34bbbcc into master Feb 4, 2019
@amaury1093 amaury1093 deleted the luke-309-electron-4 branch February 4, 2019 15:25
@amaury1093
Copy link
Collaborator

Thanks! Let's see if the binary passes on CI

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants