polkawallet-io / polkawallet-flutter

Replace to: https://github.com/polkawallet-io/app
Apache License 2.0
110 stars 49 forks source link

Missing main.js in polkadot_js_service directory #2

Closed benjamin852 closed 4 years ago

benjamin852 commented 4 years ago

Hey! Just came across this wallet looks really cool! Having an issue compiling though it says I am missing the mains.js file in the polkadot_js_service

So far I cloned your file replaced my pubspec.yaml and inserted your repo's library and added the polka_wallet.iml file

Any idea how/ where I can access this file?

Thanks!

Screen Shot 2020-02-18 at 9 15 15 AM

RomeroYang commented 4 years ago

Hey! Just came across this wallet looks really cool! Having an issue compiling though it says I am missing the mains.js file in the polkadot_js_service

So far I cloned your file replaced my pubspec.yaml and inserted your repo's library and added the polka_wallet.iml file

Any idea how/ where I can access this file?

Thanks!

Screen Shot 2020-02-18 at 9 15 15 AM

main.js is a bundle file generated from lib/polkadot_js_service/src/index.js.

You need to install nodejs & yarn and run the commands below to generate it:

cd lib/polkadot_js_service/
# install nodejs dependencies
yarn install
# build main.js
yarn run build

Besides, there's a problem running main.js with flutter_webview_plugin in ios_simulator, so you should run the app in an Android device.

benjamin852 commented 4 years ago

Ok thank you! That fixed that problem. I am also not seeing a mnemonic get generated though after I try create a new problem should one be getting generated for me automatically to write down? Thanks๐Ÿ˜Š

RomeroYang commented 4 years ago

Ok thank you! That fixed that problem. I am also not seeing a mnemonic get generated though after I try create a new problem should one be getting generated for me automatically to write down? Thanks๐Ÿ˜Š

The mnemonic comes after the account name and password settings while creating an account.

ltfschoen commented 4 years ago

I encountered the same problem when I followed the instructions. I overcame the error by running the following:

nvm use v13.12.0
cd ./lib/polkadot_js_service
rm -rf node_modules
rm yarn.lock
yarn cache clean
yarn install
yarn run build
RomeroYang commented 4 years ago

I encountered the same problem when I followed the instructions. I overcame the error by running the following:

nvm use v13.12.0
cd ./lib/polkadot_js_service
rm -rf node_modules
rm yarn.lock
yarn cache clean
yarn install
yarn run build

It will help if you could post the error logs here.

ltfschoen commented 4 years ago

@RomeroYang The issue that I encountered is because I'm working off this fork of polkawallet-flutter in the 'develop_sam' branch where a team member has commited the yarn.lock file https://github.com/DataHighway-DHX/app/pull/1/files#diff-9b70719da98e5eeb3e2b7cb5a5f632d9.

so if i clone that branch and just follow these steps:

nvm use v13.12.0
cd ./lib/polkadot_js_service
yarn install
yarn run build

then it gives me error:

ls @ ~/code/src/DataHighway-com/app/lib/polkadot_js_service - [develop_sam] $ yarn run build
yarn run v1.22.4
$ webpack -p --mode production
Hash: 6f368cb8531dccf1ba07
Version: webpack 4.41.5
Time: 323ms
Built at: 09/04/2020 4:34:49 am
 1 asset
Entrypoint main = main.js
[0] ./src/index.js 3.92 KiB {0} [built] [failed] [1 error]

ERROR in ./src/index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main resolved in /Users/ls/code/src/DataHighway-com/app/lib/polkadot_js_service/node_modules/@babel/helper-compilation-targets/package.json
    at applyExports (internal/modules/cjs/loader.js:524:9)
    at resolveExports (internal/modules/cjs/loader.js:541:12)
    at Function.Module._findPath (internal/modules/cjs/loader.js:661:22)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:963:27)
    at Function.Module._load (internal/modules/cjs/loader.js:859:27)
    at Module.require (internal/modules/cjs/loader.js:1036:19)
    at require (/Users/ls/code/src/DataHighway-com/app/lib/polkadot_js_service/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/Users/ls/code/src/DataHighway-com/app/lib/polkadot_js_service/node_modules/@babel/preset-env/lib/debug.js:8:33)
    at Module._compile (/Users/ls/code/src/DataHighway-com/app/lib/polkadot_js_service/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
    at Module.load (internal/modules/cjs/loader.js:996:32)
    at Function.Module._load (internal/modules/cjs/loader.js:896:14)
    at Module.require (internal/modules/cjs/loader.js:1036:19)
    at require (/Users/ls/code/src/DataHighway-com/app/lib/polkadot_js_service/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/Users/ls/code/src/DataHighway-com/app/lib/polkadot_js_service/node_modules/@babel/preset-env/lib/index.js:11:14)
    at Module._compile (/Users/ls/code/src/DataHighway-com/app/lib/polkadot_js_service/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
    at Module.load (internal/modules/cjs/loader.js:996:32)
    at Function.Module._load (internal/modules/cjs/loader.js:896:14)
    at Module.require (internal/modules/cjs/loader.js:1036:19)
    at require (/Users/ls/code/src/DataHighway-com/app/lib/polkadot_js_service/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at requireModule (/Users/ls/code/src/DataHighway-com/app/lib/polkadot_js_service/node_modules/@babel/core/lib/config/files/plugins.js:165:12)
    at loadPreset (/Users/ls/code/src/DataHighway-com/app/lib/polkadot_js_service/node_modules/@babel/core/lib/config/files/plugins.js:83:17)
    at createDescriptor (/Users/ls/code/src/DataHighway-com/app/lib/polkadot_js_service/node_modules/@babel/core/lib/config/config-descriptors.js:154:9)
    at /Users/ls/code/src/DataHighway-com/app/lib/polkadot_js_service/node_modules/@babel/core/lib/config/config-descriptors.js:109:50
    at Array.map (<anonymous>)
    at createDescriptors (/Users/ls/code/src/DataHighway-com/app/lib/polkadot_js_service/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)
    at createPresetDescriptors (/Users/ls/code/src/DataHighway-com/app/lib/polkadot_js_service/node_modules/@babel/core/lib/config/config-descriptors.js:101:10)
    at presets (/Users/ls/code/src/DataHighway-com/app/lib/polkadot_js_service/node_modules/@babel/core/lib/config/config-descriptors.js:47:19)
    at mergeChainOpts (/Users/ls/code/src/DataHighway-com/app/lib/polkadot_js_service/node_modules/@babel/core/lib/config/config-chain.js:320:26)
    at /Users/ls/code/src/DataHighway-com/app/lib/polkadot_js_service/node_modules/@babel/core/lib/config/config-chain.js:283:7
    at Generator.next (<anonymous>)
    at buildRootChain (/Users/ls/code/src/DataHighway-com/app/lib/polkadot_js_service/node_modules/@babel/core/lib/config/config-chain.js:120:29)
    at buildRootChain.next (<anonymous>)
    at loadPrivatePartialConfig (/Users/ls/code/src/DataHighway-com/app/lib/polkadot_js_service/node_modules/@babel/core/lib/config/partial.js:95:62)
    at loadPrivatePartialConfig.next (<anonymous>)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

But after I delete the yarn.lock file and then re-run the following it works:

rm yarn.lock
yarn install
yarn run build
ls @ ~/code/src/DataHighway-com/app/lib/polkadot_js_service - [develop_sam] $ rm yarn.lock 
ls @ ~/code/src/DataHighway-com/app/lib/polkadot_js_service - [develop_sam] $ yarn; yarn run build
yarn install v1.22.4
info No lockfile found.
[1/4] ๐Ÿ”  Resolving packages...
warning @babel/polyfill > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning @webpack-cli/init > jscodeshift > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning @webpack-cli/init > jscodeshift > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning @webpack-cli/init > @webpack-cli/generators > mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
warning @webpack-cli/init > @webpack-cli/utils > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > left-pad@1.3.0: use String.prototype.padStart()
warning @webpack-cli/init > @webpack-cli/utils > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
warning " > @polkadot/ui-shared@0.51.1" has unmet peer dependency "@polkadot/util-crypto@*".
warning "@webpack-cli/init > @webpack-cli/generators > inquirer-autocomplete-prompt@1.0.1" has unmet peer dependency "inquirer@^5.0.0 || ^6.0.0".
[4/4] ๐Ÿ”จ  Building fresh packages...
success Saved lockfile.
โœจ  Done in 33.31s.
yarn run v1.22.4
$ webpack -p --mode production
Hash: b613686a1806ea59e9ea
Version: webpack 4.42.1
Time: 13001ms
Built at: 09/04/2020 4:40:03 am
  Asset      Size  Chunks                    Chunk Names
main.js  1.96 MiB       0  [emitted]  [big]  main
Entrypoint main [big] = main.js
   [5] ./node_modules/rxjs/_esm5/internal/Observable.js + 1 modules 4.75 KiB {0} [built]
       |    2 modules
   [7] ./node_modules/rxjs/_esm5/operators/index.js + 97 modules 176 KiB {0} [built]
       |    98 modules
  [10] ./node_modules/rxjs/_esm5/index.js + 19 modules 35.8 KiB {0} [built]
       |    20 modules
  [42] (webpack)/buildin/global.js 472 bytes {0} [built]
  [71] (webpack)/buildin/module.js 497 bytes {0} [built]
  [79] ./node_modules/rxjs/_esm5/internal/scheduler/AsyncAction.js + 1 modules 3.5 KiB {0} [built]
       |    2 modules
 [116] ./node_modules/rxjs/_esm5/internal/util/subscribeTo.js + 3 modules 3.42 KiB {0} [built]
       |    4 modules
 [140] ./node_modules/rxjs/_esm5/internal/scheduler/asap.js + 3 modules 3.7 KiB {0} [built]
       |    4 modules
 [207] ./node_modules/rxjs/_esm5/internal/scheduled/scheduled.js + 5 modules 5.14 KiB {0} [built]
       |    6 modules
 [208] ./node_modules/rxjs/_esm5/internal/scheduler/queue.js + 2 modules 2.19 KiB {0} [built]
       |    3 modules
 [663] buffer (ignored) 15 bytes {0} [optional] [built]
 [743] crypto (ignored) 15 bytes {0} [optional] [built]
 [814] (webpack)/buildin/amd-options.js 80 bytes {0} [built]
 [819] crypto (ignored) 15 bytes {0} [built]
[1170] ./src/index.js + 4 modules 48 KiB {0} [built]
       | ./src/index.js 3.15 KiB [built]
       | ./src/service/account.js 15 KiB [built]
       | ./src/service/staking.js 23.4 KiB [built]
       | ./src/utils/registry.js 107 bytes [built]
       | ./src/service/gov.js 6.34 KiB [built]
    + 1156 hidden modules