执行npm run test时触发Cardano(ADA)节点配置及cucumber脚本错误
解决Nix Shell中Daedalus执行
npm run test时的ELIFECYCLE错误(关联Cardano节点配置) 我之前处理过类似的Daedalus测试脚本失败问题,结合你提供的环境信息和错误日志,咱们来一步步定位和解决问题:
环境信息汇总
- 运行环境:Nix Shell,工作目录
~/daedalus - 系统版本:Linux 4.14.12-x86_64-linode92
- Node.js/npm版本:node v6.11.1、npm v3.10.10
- Daedalus版本:daedalus@0.8.0
错误核心问题
执行npm run test时,该命令会调用npm run cucumber脚本,但脚本执行失败,返回ELIFECYCLE错误(退出状态码1)。根据日志提示,若已安装最新Node/npm,问题大概率出在Daedalus包本身,且经分析该错误与Cardano(ADA)节点配置相关。
完整错误日志
[nix-shell:~/daedalus]$ npm run test npm ERR! Linux 4.14.12-x86_64-linode92 npm ERR! argv "/nix/store/r8vffmcbmdvx5f1z1ncbgcf70jd0r21h-nodejs-6.11.1/bin/node" "/nix/store/r8vffmcbmdvx5f1z1ncbgcf70jd0r21h-nodejs-6.11.1/bin/npm" "run" "cucumber" npm ERR! node v6.11.1 npm ERR! npm v3.10.10 npm ERR! code ELIFECYCLE npm ERR! daedalus@0.8.0 cucumber: cross-env NODE_ENV=test BABEL_DISABLE_CACHE=1 cucumber-js --compiler js:babel-register --format 'progress-bar' --format-options '{"snippetInterface": "synchronous"}' --tags 'not @skip' npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the daedalus@0.8.0 cucumber script 'cross-env NODE_ENV=test BABEL_DISABLE_CACHE=1 cucumber-js --compiler js:babel-register --format 'progress-bar' --format-options '{"snippetInterface": "synchronous"}' --tags 'not @skip''. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the daedalus package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! cross-env NODE_ENV=test BABEL_DISABLE_CACHE=1 cucumber-js --compiler js:babel-register --format 'progress-bar' --format-options '{"snippetInterface": "synchronous"}' --tags 'not @skip' npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs daedalus npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls daedalus npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! /root/daedalus/npm-debug.log npm ERR! Linux 4.14.12-x86_64-linode92 npm ERR! argv "/nix/store/r8vffmcbmdvx5f1z1ncbgcf70jd0r21h-nodejs-6.11.1/bin/node" "/nix/store/r8vffmcbmdvx5f1z1ncbgcf70jd0r21h-nodejs-6.11.1/bin/npm" "run" "test" npm ERR! node v6.11.1 npm ERR! npm v3.10.10 npm ERR! code ELIFECYCLE npm ERR! daedalus@0.8.0 test: npm run cucumber npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the daedalus@0.8.0 test script 'npm run cucumber'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the daedalus package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! npm run cucumber npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs daedalus npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls daedalus npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! /root/daedalus/npm-debug.log
解决建议
排查Cardano节点配置(优先级最高)
- 确认本地Cardano节点是否正常启动并处于运行状态,可以使用节点自带的状态检查命令验证
- 检查Daedalus配置文件中指向Cardano节点的地址、端口是否正确,当前用户是否有权限访问该节点服务
升级Node.js和npm版本
你当前使用的Node v6.11.1是已停止维护的老旧版本,Daedalus@0.8.0可能对Node版本有特定兼容要求。建议升级到对应版本的LTS版本(比如v14或v16,可参考Daedalus 0.8.0的官方文档),再重新执行测试命令。查看详细调试日志
按照错误提示,查看/root/daedalus/npm-debug.log文件,里面会记录更具体的失败细节(比如某个测试步骤无法连接节点、依赖缺失等),这能帮你快速定位问题根源。重新安装项目依赖
可能存在依赖安装不完整或版本冲突的情况,尝试执行以下命令重置依赖:rm -rf node_modules package-lock.json npm install安装完成后再次执行
npm run test测试。单独运行Cucumber脚本排查
直接执行Cucumber的原始命令,跳过npm脚本的封装,这样能得到更直接的错误输出:cross-env NODE_ENV=test BABEL_DISABLE_CACHE=1 cucumber-js --compiler js:babel-register --format 'progress-bar' --format-options '{"snippetInterface": "synchronous"}' --tags 'not @skip'
内容的提问来源于stack exchange,提问作者Desmond Than
相关产品推荐
相关产品推荐

