Open xifengiOS opened 1 year ago
I was also getting this error when performing the build commands on Windows 10.
Switching to Linux/WSL made this problem disappear: On Linux: First install nvm.
git clone https://github.com/frida/frida-swift-bridge.git
cd frida-swift-bridge
nvm install 20
nvm use 20
npm install
npm run watch
That creates in my environment an _agent.js
that does not cause the error ReferenceError: 'require' is not defined
.
I finally managed to build frida-swift-bridge on Windows. The problem may be caused by older versions of tsc and frida-compile that have been installed globally. So you just have to make sure to use the versions of tsc
and frida-compile
that are installed locally into node_modules\.bin
directory by the npm install
command:
Just compile (no watch and automatic recompile in case of source files changes) execute:
git clone https://github.com/frida/frida-swift-bridge.git
cd frida-swift-bridge
npm install
.\node_modules\.bin\tsc.cmd
.\node_modules\.bin\frida-compile -o _agent.js loader.js
You can see that it had worked by the size of the generated _agent.js
. The defect version which causes ReferenceError: 'require' is not defined
has ~1 KB. The correct version has 145 KB.
ReferenceError: 'require' is not defined at (loader.js:1)