I am using browserify v17.0.0 in order to use node.js modules in a web project. This was working fine until today when I attempted to convert src file as follows:
call browserify web-src.js -o web.js
Error: Can't walk dependency graph: ENOENT: no such file or directory, lstat '${home_dir}\process'
required by ${home_dir}\node_modules\mysql2\lib\pool.js
(very odd as I haven't changed the version of browserify or any of the code!).
The process module is present in node_modules, and I have tried clearing npm cache and completely reinstalling with npm install
If I disable all imports that use the mysql2 library above, then I can compile web.js successfully with the above commands. However, when I attempt to serve this file with an express.js web server, there is an error:
Uncaught TypeError: Cannot read properties of undefined (reading 'split')
at Object.<anonymous> (web.js:122518)
at Object.<anonymous> (web.js:122527)
at Object.780../lib/telegram (web.js:122527)
at o (web.js:1)
at web.js:1
at Object.<anonymous> (web.js:171670)
at Object.<anonymous> (web.js:171981)
at Object.944.../database/database-functions (web.js:171981)
at o (web.js:1)
at web.js:1
Which refers to the following line in the compiled code:
const majorVersion = parseInt(process.versions.node.split('.')[0]