Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move devDependencies that required to compile the app to dependencies #2611

Open
emanuelb opened this issue May 15, 2021 · 6 comments
Open

Comments

@emanuelb
Copy link

Ensure all dependencies used to compile the android & ios version are in dependencies, and compilation work when NODE_ENV="production" environment variable is used.

as currently the steps in compiling android app fails when node production mode is used:
command: yarn postinstall

Error: /bin/sh: patch-package: not found

cause patch-package is in devDependencies instead of dependencies

"patch-package": "^6.2.2",

Command: yarn prepare

Error: Cannot find module '/home/appuser/app/edge/edge-react-gui/node_modules/.bin/rollup'

"rollup": "^1.1.2",

cause rollup is in devDependencies instead of dependencies

@paullinator
Copy link
Member

devDependencies are installed just like dependencies when cloning the full application. This has not been a problem for anyone else building the application.

@emanuelb
Copy link
Author

devDependencies are installed only if node running in development mode, when it's run in production mode either by NODE_ENV="production" environment variable or when --production argument is added or when npm ci is used.
The npm ci will install exact packages from lockfile in production mode, and is needed for reproducible-builds.

@paullinator
Copy link
Member

Ok understood. @thehobbit85 can you task this to someone

@emanuelb
Copy link
Author

Another such dependency that should be moved to dependencies is jetifier until issue #2613 is fixed (to remove this dependency)

"jetifier": "^1.6.5",

@emanuelb
Copy link
Author

More such devDeps to move to deps are:
rollup-plugin-node-resolve webpack-cli babel-loader edge-plugin-bity edge-plugin-simplex edge-plugin-wyre

Details below:

"rollup-plugin-node-resolve": "4.0.0",

Otherwise error like:

$ ./prepare-assets.sh
[!] Error: Cannot find module 'rollup-plugin-node-resolve'
Require stack:
- /home/appuser/app/edge/edge-react-gui-2.0.10/rollup.config.js
- /home/appuser/app/edge/edge-react-gui-2.0.10/node_modules/rollup/dist/shared/loadConfigFile.js
- /home/appuser/app/edge/edge-react-gui-2.0.10/node_modules/rollup/dist/bin/rollup
Error: Cannot find module 'rollup-plugin-node-resolve'
Require stack:
- /home/appuser/app/edge/edge-react-gui-2.0.10/rollup.config.js
- /home/appuser/app/edge/edge-react-gui-2.0.10/node_modules/rollup/dist/shared/loadConfigFile.js
- /home/appuser/app/edge/edge-react-gui-2.0.10/node_modules/rollup/dist/bin/rollup
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/home/appuser/app/edge/edge-react-gui-2.0.10/rollup.config.js:5:15)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.require.extensions.<computed> [as .js] (/home/appuser/app/edge/edge-react-gui-2.0.10/node_modules/rollup/dist/shared/loadConfigFile.js:530:20)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)

edge-react-gui/package.json

Lines 201 to 203 in 9b23455

"edge-plugin-bity": "https://github.com/EdgeApp/edge-plugin-bity.git#f04ee29c23bf5621f87dedb6d2fb1c83a18781bc",
"edge-plugin-simplex": "https://github.com/EdgeApp/edge-plugin-simplex.git#efb0f2280192894e4c24e28e297d0e466f2d333b",
"edge-plugin-wyre": "https://github.com/EdgeApp/edge-plugin-wyre.git#5aa2379dbd4045b8a514427b442bd59ca57c21b0",

Move this lines of "edge-plugin-bity" "edge-plugin-simplex" "edge-plugin-wyre"

Otherwise errors like:

./src/util/bridge/bridge.js → ./src/util/bridge/rolledUp.js...
created ./src/util/bridge/rolledUp.js in 176ms
internal/modules/cjs/loader.js:883
  throw err;
  ^

Error: Cannot find module './node_modules/edge-plugin-simplex/manifest.json'
Require stack:
- /home/appuser/app/edge/edge-react-gui-2.0.10/copy-plugin.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at copyAssets (/home/appuser/app/edge/edge-react-gui-2.0.10/copy-plugin.js:19:20)
    at /home/appuser/app/edge/edge-react-gui-2.0.10/copy-plugin.js:32:5
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/home/appuser/app/edge/edge-react-gui-2.0.10/copy-plugin.js:31:11)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/home/appuser/app/edge/edge-react-gui-2.0.10/copy-plugin.js' ]
}

"webpack-cli": "^3.2.3"

Otherwise error like:

./src/util/bridge/bridge.js → ./src/util/bridge/rolledUp.js...
created ./src/util/bridge/rolledUp.js in 154ms
internal/modules/cjs/loader.js:883
  throw err;
  ^

Error: Cannot find module '/home/appuser/app/edge/edge-react-gui-2.0.10/node_modules/.bin/webpack'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

"babel-loader": "^8.0.5",

Otherwise error like:

./src/util/bridge/bridge.js → ./src/util/bridge/rolledUp.js...
created ./src/util/bridge/rolledUp.js in 148ms

Insufficient number of arguments or no entry found.
Alternatively, run 'webpack(-cli) --help' for usage info.

ERROR in Entry module not found: Error: Can't resolve 'babel-loader' in '/home/appuser/app/edge/edge-react-gui-2.0.10'
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

samholmes added a commit that referenced this issue Jun 10, 2021
Dependencies required to compile the app have been moved from
devDependencies to dependencies to resolve issue #2611.
@swansontec
Copy link
Contributor

swansontec commented Jun 10, 2021

If you want reproducible builds, try using the command yarn install --frozen-lockfile --production=false to get the devDependencies, even if you have NODE_ENV=production in your environment. If you are building the app, you need the build tools, and the build tools are devDependencies. Even the react native template project puts build-time dependencies like metro-react-native-babel-preset in the devDependencies.

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

No branches or pull requests

3 participants