amqp / rhea

A reactive messaging library based on the AMQP protocol
Apache License 2.0
280 stars 79 forks source link

Error: Cannot find module 'rhea' #328

Open mimdev opened 3 years ago

mimdev commented 3 years ago

Hello,

I am trying to use your library for a simple send JMS, but i have the following error:

internal/modules/cjs/loader.js:883 throw err; ^ Error: Cannot find module 'rhea' Require stack:

So what is that error and how can i solve it ? Best regards.

mimdev commented 3 years ago

When i try : npm i rhea

_C:\eclipse-workspace\rhea-master\examples>npm i rhea npm ERR! code ENOSELF npm ERR! Refusing to install package with name "rhea" under a package npm ERR! also called "rhea". Did you name your project the same npm ERR! as the dependency you're installing? npm ERR! npm ERR! For more information, see: npm ERR! https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\AppData\Roaming\npm-cache_logs\2020-12-02T10_47_49517Z-debug.log

thank you,

grs commented 3 years ago

I don't use cjs-loader, so can't give you any direct advice. Are you running from a browser or using node.js? If the latter you could try deleting node_modules then run npm install again. If using a browser it is most likely a path issue (or perhaps a build process issue?).

I've used browserify successfully for use in borwsers (see client.html under websocket examples).

mimdev commented 3 years ago

Hello,

First, thank you for your return. I dont' use cjs-loader, i have just checkout "rhea project".

i use node.js, and when i run npm install, i have some errors:

__npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! rhea@1.0.24 tsc: tsc npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the rhea@1.0.24 tsc script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\AppData\Roaming\npm-cache_logs\2020-12-02T12_41_28_269Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! rhea@1.0.24 prepare: npm run lint && npm run tsc npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the rhea@1.0.24 prepare script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\AppData\Roaming\npm-cache_logs\2020-12-02T12_41_28_349Z-debug.log__

Do you have an idea ?

Thank you Best regards,

grs commented 3 years ago

try: npm install -g typescript

Usually however you will create your own project directory and define rhea as a dependency in pacakge.json. Then when you npm install, reha and any other dependencies will be pulled in as needed.

mimdev commented 3 years ago

Yes i create a new project directory and my package.json:

{ "name": "rhea", "version": "1.0.24", "description": "reactive AMQP 1.0 library", "homepage": "http://github.com/amqp/rhea", "license": "Apache-2.0", "repository": { "type": "git", "url": "http://github.com/amqp/rhea" }, "browser": { "fs": false, "net": false, "tls": false }, "dependencies": { "debug": "0.8.0 - 3.5.0" }, "devDependencies": { "@types/node": "^8.0.37", "@types/debug": "^0.0.30", "@types/mocha": "^5.2.0", "browserify": "", "eslint": "^4.19.1", "istanbul": "1.1.0-alpha.1", "minimist": "", "mocha": "^3.0.0", "uglify-js": "", "require-self": "^0.2.1", "ws": "^6.0.0", "typescript": "^3.0.1", "ts-node": "^7.0.0" }, "scripts": { "lint": "eslint lib/.js", "test": "npm run lint && npm run tsc && mocha -r ts-node/register ./test/.ts", "coverage": "istanbul cover _mocha -- test/*.ts --compilers ts-node/register", "browserify": "browserify -r .:rhea -o dist/rhea.js", "run-examples": "require-self && mocha examples/test_examples.js", "uglify": "uglifyjs --source-map --output dist/rhea.min.js dist/rhea.js", "prepare": "npm run lint && npm run tsc", "tsc": "tsc" }, "keywords": [ "amqp", "messaging" ], "main": "./lib/container.js", "types": "./typings/index.d.ts" }

And when i run npm install, i have the same errors.

grs commented 3 years ago

That is the package definition for rhea. You should create one for your application with rhea only listed in the dependencies section.

mimdev commented 3 years ago

All right, so i must have 2 JSON package ? Have you an example for the application ?

Thank you in advance.

mimdev commented 3 years ago

it works ! Thank you very much for your help. he was missing rhea dependencies

Nice day