repack icon indicating copy to clipboard operation
repack copied to clipboard

Get error when bundling the app

Open daiquangduy opened this issue 2 years ago • 1 comments

Environment

"dependencies": { "@callstack/repack": "^2.4.2", "@react-native-async-storage/async-storage": "^1.15.9", "react": "17.0.1", "react-native": "0.64.2" }, "devDependencies": { "@babel/core": "^7.12.9", "@babel/runtime": "^7.12.5", "@react-native-community/eslint-config": "^2.0.0", "babel-jest": "^26.6.3", "babel-loader": "^8.2.3", "eslint": "7.14.0", "jest": "^26.6.3", "metro-react-native-babel-preset": "^0.64.0", "react-test-renderer": "17.0.1", "terser-webpack-plugin": "^5.1.3", "webpack": "^5.50.0" },

Description

When I run "npx react-native webpack-bundle", I get the error:

error The "path" argument must be of type string. Received undefined TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined at new NodeError (node:internal/errors:329:5) at validateString (node:internal/validators:129:11) at Object.isAbsolute (node:path:1070:5) at Object.getEntry (/Users/mac/Documents/Code/DemoMiniApps/node_modules/@callstack/repack/dist/webpack/utils/env/getEntry.js:29:26) at Object. (/Users/mac/Documents/Code/DemoMiniApps/webpack.config.js:37:27) at Module._compile (node:internal/modules/cjs/loader:1092:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10) at Module.load (node:internal/modules/cjs/loader:972:32) at Function.Module._load (node:internal/modules/cjs/loader:813:14) at Module.require (node:internal/modules/cjs/loader:996:19)

When I run "PLATFORM=ios npx webpack-cli -c webpack.config.js", I get the error: Running...[webpack-cli] TypeError: The 'compilation' argument must be an instance of Compilation at Function.getCompilationHooks (/Users/mac/Documents/Code/DemoMiniApps/node_modules/webpack/lib/NormalModule.js:207:10) at /Users/mac/Documents/Code/DemoMiniApps/node_modules/webpack/lib/HotModuleReplacementPlugin.js:765:18 at Hook.eval [as call] (eval at create (/Users/mac/.npm/_npx/73f0de3f6fbaf968/node_modules/tapable/lib/HookCodeFactory.js:19:10), :106:1) at Hook.CALL_DELEGATE [as _call] (/Users/mac/.npm/_npx/73f0de3f6fbaf968/node_modules/tapable/lib/Hook.js:14:14) at Compiler.newCompilation (/Users/mac/.npm/_npx/73f0de3f6fbaf968/node_modules/webpack/lib/Compiler.js:1053:26) at /Users/mac/.npm/_npx/73f0de3f6fbaf968/node_modules/webpack/lib/Compiler.js:1097:29 at Hook.eval [as callAsync] (eval at create (/Users/mac/.npm/_npx/73f0de3f6fbaf968/node_modules/tapable/lib/HookCodeFactory.js:33:10), :6:1) at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/mac/.npm/_npx/73f0de3f6fbaf968/node_modules/tapable/lib/Hook.js:18:14) at Compiler.compile (/Users/mac/.npm/_npx/73f0de3f6fbaf968/node_modules/webpack/lib/Compiler.js:1092:28) at /Users/mac/.npm/_npx/73f0de3f6fbaf968/node_modules/webpack/lib/Compiler.js:517:12

daiquangduy avatar Oct 26 '21 02:10 daiquangduy

When I run "npx react-native webpack-bundle", I get the error:

error The "path" argument must be of type string. Received undefined

You're missing --platform, --entry-file and --bundle-output options. You need to pass the same options as you would pass to react-native bundle.

When I run "PLATFORM=ios npx webpack-cli -c webpack.config.js", I get the error: Running...[webpack-cli] TypeError: The 'compilation' argument must be an instance of Compilation

You have multiple incompatible versions of Webpack:

  • /Users/mac/Documents/Code/DemoMiniApps/node_modules/webpack
  • /Users/mac/.npm/_npx/73f0de3f6fbaf968/node_modules/webpack I suggest to remove the global one.

zamotany avatar Oct 26 '21 08:10 zamotany

Looks like the issue was resolved, closing due to inactivity.

RafikiTiki avatar Dec 28 '22 16:12 RafikiTiki

I am using following command

npx react-native webpack-bundle --platform ios --entry-file index.js --bundle-output dist/bundle.js

but still getting the above error.

TypeError: The "path" argument must be of type string. Received undefined at new NodeError (node:internal/errors:405:5) at validateString (node:internal/validators:162:11) at Object.join (node:path:1175:7) at AssetsCopyProcessor.enqueueChunk (/Users/shivsharma/rn-micro-frontend-boilerplate/rn-mini-app-two/node_modules/@callstack/repack/dist/webpack/plugins/utils/AssetsCopyProcessor.js:49:70) at /Users/shivsharma/rn-micro-frontend-boilerplate/rn-mini-app-two/node_modules/@callstack/repack/dist/webpack/plugins/OutputPlugin.js:225:55 at Hook.eval [as callAsync] (eval at create (/Users/shivsharma/rn-micro-frontend-boilerplate/rn-mini-app-two/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:8:17) at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/shivsharma/rn-micro-frontend-boilerplate/rn-mini-app-two/node_modules/tapable/lib/Hook.js:18:14) at /Users/shivsharma/rn-micro-frontend-boilerplate/rn-mini-app-two/node_modules/webpack/lib/Compiler.js:882:27 at /Users/shivsharma/rn-micro-frontend-boilerplate/rn-mini-app-two/node_modules/neo-async/async.js:2818:7 at done (/Users/shivsharma/rn-micro-frontend-boilerplate/rn-mini-app-two/node_modules/neo-async/async.js:3522:9) at alreadyWritten (/Users/shivsharma/rn-micro-frontend-boilerplate/rn-mini-app-two/node_modules/webpack/lib/Compiler.js:714:8) at /Users/shivsharma/rn-micro-frontend-boilerplate/rn-mini-app-two/node_modules/webpack/lib/Compiler.js:802:19 at /Users/shivsharma/rn-micro-frontend-boilerplate/rn-mini-app-two/node_modules/graceful-fs/graceful-fs.js:123:16 at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3) { code: 'ERR_INVALID_ARG_TYPE' }

shivdotpy avatar Aug 11 '23 06:08 shivdotpy

Hey @shivdotpy,

what version of RePack are you using? We've fixed this a while back.

jbroma avatar Aug 11 '23 08:08 jbroma

hi @jbroma , where can we have a full tuto of react native RePack full deploy process???

heradonbenin avatar Jan 29 '24 10:01 heradonbenin

@heradonbenin please create a seperate issue and describe your problem in detail.

jbroma avatar Jan 29 '24 14:01 jbroma

@heradonbenin please create a seperate issue and describe your problem in detail.

@jbroma new issue created : https://github.com/callstack/repack/issues/490

heradonbenin avatar Jan 30 '24 09:01 heradonbenin