Search code examples
javascriptnode.jsnpmbrowserifylibsodium

Can't walk dependency graph: Cannot find module './crypto_auth' sodium-universal


I am getting the following error when attempting to browserify a node project (https://github.com/datproject/sdk) and am getting the following error.

Error: Can't walk dependency graph: Cannot find module './crypto_auth' from 'C:\myPath\node_modules\sodium-universal\index.js'
    required by C:\myPath\node_modules\sodium-universal\index.js
    at C:\myPath\node_modules\resolve\lib\async.js:137:35
    at load (C:\myPath\node_modules\resolve\lib\async.js:156:43)
    at onex (C:\myPath\node_modules\resolve\lib\async.js:181:17)
    at C:\myPath\node_modules\resolve\lib\async.js:15:69
    at FSReqCallback.oncomplete (fs.js:158:21)
npm ERR! code ELIFECYCLE

Usually I'd npm install the missing module. However, this doesn't work in this case. Also I can find no mention of crypt_auth anywhere in the project (the referencedindex.js has a single line module.exports = require('sodium-native'))

How do I debug this?


Solution

  • After Paul90's comment here, I solved like this:

    1. cd into the yourPath/node_modules/sodium-universal/build-scripts dir
    2. run node generate.js
    3. go back to the sdk dir and run npm run build