pub-sub example: fail to run "Cannot find module"
See original GitHub issueError
When running pub-sub example I am getting this error -
internal/modules/cjs/loader.js:905
throw err;
^
Error: Cannot find module '../../../proto/dapr/proto/runtime/v1/dapr_pb'
Require stack:
- /Users/yosi/code/dapr-js-sdk/build/implementation/Client/GRPCClient/binding.js
- /Users/yosi/code/dapr-js-sdk/build/implementation/Client/DaprClient.js
- /Users/yosi/code/dapr-js-sdk/build/index.js
- /Users/yosi/code/dapr-js-sdk/examples/pubsub/dist/index.js
Steps to Reproduce the Problem
> git clone git clone git@github.com:dapr/js-sdk.git dapr-js-sdk
> cd dapr-js-sdk
> npm install
> npm run build
> cd examples/pubsub
> npm install
> npm run start:dapr-http
Workaround
I changed the dapr-client
dependency to come from npm instead of relative file
Environment info:
- node version: 14.18.1
- npm version: 6.14.15
Using dapr installed via homebrew -
CLI version: 1.4.0
Runtime version: 1.4.3
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Cannot find module 'google-cloud/pubsub' when deploying app
I've found the source of the error. In the package.json file, I had forgotten to include pubsub as a dependency.
Read more >Cannot find module 'google-cloud/pubsub' when deploying ...
Coding example for the question Cannot find module 'google-cloud/pubsub' when deploying app-node.js. ... I've found the source of the error.
Read more >event-pubsub - npm
Super light and fast Extensible ES6+ events and EventEmitters for Node and the browser. Easy for any developer level, use the same exact ......
Read more >Troubleshoot Dataflow errors | Google Cloud
Cannot read and write in different locations. When you run a Dataflow job, you might see the following error in the log files:....
Read more >Subscriptions in Apollo Server - Apollo GraphQL Docs
Apollo Server does not provide built-in support for subscriptions. ... For example, a chat application's server might use a subscription to push newly ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks a lot for your PR! I will close this issue then, if there are any more problems feel free to reopen or ping me
Found the issue - https://github.com/dapr/js-sdk/blob/master/scripts/build.sh#L31
We are doing -
cp -R ./src/proto/ ./build
In mac, it copies the contents of
./src/proto
tobuild
directory, while in linux (tested on popos) it copies theproto
folder tobuild
.As you can see, there is no
proto
directory, there are dapr & google which are contents of src/protoIf I removed the
/
(./src/proto/
->./src/proto
) it works correctly -To test it works correctly, did the change in scripts/build.sh and now the example is working 🎉
Created fix PR - https://github.com/dapr/js-sdk/pull/130