Я пытаюсь запустить пример nodejs server/client trift, но я не могу заставить его работать. Первоначально, я добавил бережливость в качестве зависимости в моем файле package.json
. Затем я сделал npm install
, который установил бережливость. Затем я попытался запустить сервер, используя node NodeServer.js
. Я получаю аналогичную ошибку, когда пытаюсь запустить NodeClient.js
.Ссылка на Thrift не найдена при запуске nodejs Пример Thrift
Ссылка на комиссионном nodejs учебник - http://thrift.apache.org/tutorial/nodejs
Я приложил вывод соответствующих команд ниже.
[email protected]:~/git/nodejs-thrift$ ls
gen-js NodeClient.js NodeServer.js package.json shared.thrift tutorial.thrift
[email protected]:~/git/nodejs-thrift$ npm install
> [email protected] install /home/h/git/nodejs-thrift/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
make: Entering directory '/home/h/git/nodejs-thrift/node_modules/ws/build'
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
bufferutil.target.mk:92: recipe for target 'Release/obj.target/bufferutil/src/bufferutil.o' failed
make: Leaving directory '/home/h/git/nodejs-thrift/node_modules/ws/build'
[email protected] /home/h/git/nodejs-thrift
└─┬ [email protected]
├── [email protected]
├── [email protected]
└─┬ [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
[email protected]:~/git/nodejs-thrift$ node NodeServer.js
/home/h/git/nodejs-thrift/gen-js/Calculator.js:384
Thrift.inherits(CalculatorClient, SharedServiceClient)
^
ReferenceError: Thrift is not defined
at Object.<anonymous> (/home/h/git/nodejs-thrift/gen-js/Calculator.js:384:1)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/h/git/nodejs-thrift/NodeServer.js:21:18)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
[email protected]:~/git/nodejs-thrift$