我刚刚使用
安装了一个包 - https://github.com/ryohey/node-stratum-clientnpm install node-stratum-client
虽然我可以看到安装此文件
./node_modules/node-stratum-client/src/StratumClient.ts
当我尝试运行包含这些行的节点脚本时
require("node-stratum-client")
const client = new StratumClient()
我收到错误
/Users/satishp/Documents/workspace/run.js:3
const client = new StratumClient()
^
ReferenceError: StratumClient is not defined
at Object.<anonymous> (/Users/satishp/Documents/workspace/run.js:3:16)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Function.Module.runMain (module.js:701:10)
at startup (bootstrap_node.js:193:16)
at bootstrap_node.js:617:3
我使用的是npm v 5.6.0。我需要安装哪个文件,以便我的节点脚本能够识别我安装的模块?
答案 0 :(得分:0)
您需要将所需模块存储在变量中:
const StratumClient = require('node-stratum-client')
const client = new StratumClient()