无法行走依赖图:找不到模块“./crypto_auth”钠通用

问题描述

我在尝试浏览节点项目 (https://github.com/datproject/sdk) 时收到以下错误,并收到以下错误

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

通常我会npm install缺少的模块。但是,这在这种情况下不起作用。此外,我在项目的任何地方都找不到 crypt_auth 的提及(引用的index.js 有一行 module.exports = require('sodium-native')

我该如何调试?

解决方法

在 Paul90 的评论 here 之后,我是这样解决的:

  1. cd 到 yourPath/node_modules/sodium-universal/build-scripts 目录
  2. 运行node generate.js
  3. 返回到 sdk 目录并运行 npm run build