nasa8x / rss-to-json

RSS and Atom feed generator for Node.js
https://morioh.com/@5df445b0103f3007600e1a57
175 stars 77 forks source link

Unable to use #3

Open deepakkj opened 6 years ago

deepakkj commented 6 years ago

I'm getting the following error, when trying to use it. Not sure where I am going wrong.

I am using webpack 3 with webpack-dev-sever

`ERROR in ./node_modules/rss-to-json/node_modules/request/lib/har.js Module not found: Error: Can't resolve 'fs' in 'D:\Projects\React Redux News Feed App\node_modules\rss-to-json\node_modules\request\lib' @ ./node_modules/rss-to-json/node_modules/request/lib/har.js 3:9-22 @ ./node_modules/rss-to-json/node_modules/request/request.js @ ./node_modules/rss-to-json/node_modules/request/index.js @ ./node_modules/rss-to-json/src/rss.js @ ./node_modules/rss-to-json/index.js @ ./src/actions/channelActions.js @ ./src/app.js @ multi (webpack)-dev-server/client?http://localhost:8080 ./src/app.js

ERROR in ./node_modules/forever-agent/index.js Module not found: Error: Can't resolve 'net' in 'D:\Projects\React Redux News Feed App\node_modules\forever-agent' @ ./node_modules/forever-agent/index.js 6:10-24 @ ./node_modules/rss-to-json/node_modules/request/request.js @ ./node_modules/rss-to-json/node_modules/request/index.js @ ./node_modules/rss-to-json/src/rss.js @ ./node_modules/rss-to-json/index.js @ ./src/actions/channelActions.js @ ./src/app.js @ multi (webpack)-dev-server/client?http://localhost:8080 ./src/app.js

ERROR in ./node_modules/tough-cookie/lib/cookie.js Module not found: Error: Can't resolve 'net' in 'D:\Projects\React Redux News Feed App\node_modules\tough-cookie\lib' @ ./node_modules/tough-cookie/lib/cookie.js 32:10-24 @ ./node_modules/rss-to-json/node_modules/request/lib/cookies.js @ ./node_modules/rss-to-json/node_modules/request/index.js @ ./node_modules/rss-to-json/src/rss.js @ ./node_modules/rss-to-json/index.js @ ./src/actions/channelActions.js @ ./src/app.js @ multi (webpack)-dev-server/client?http://localhost:8080 ./src/app.js

ERROR in ./node_modules/tunnel-agent/index.js Module not found: Error: Can't resolve 'net' in 'D:\Projects\React Redux News Feed App\node_modules\tunnel-agent' @ ./node_modules/tunnel-agent/index.js 3:10-24 @ ./node_modules/rss-to-json/node_modules/request/lib/tunnel.js @ ./node_modules/rss-to-json/node_modules/request/request.js @ ./node_modules/rss-to-json/node_modules/request/index.js @ ./node_modules/rss-to-json/src/rss.js @ ./node_modules/rss-to-json/index.js @ ./src/actions/channelActions.js @ ./src/app.js @ multi (webpack)-dev-server/client?http://localhost:8080 ./src/app.js

ERROR in ./node_modules/forever-agent/index.js Module not found: Error: Can't resolve 'tls' in 'D:\Projects\React Redux News Feed App\node_modules\forever-agent' @ ./node_modules/forever-agent/index.js 7:10-24 @ ./node_modules/rss-to-json/node_modules/request/request.js @ ./node_modules/rss-to-json/node_modules/request/index.js @ ./node_modules/rss-to-json/src/rss.js @ ./node_modules/rss-to-json/index.js @ ./src/actions/channelActions.js @ ./src/app.js @ multi (webpack)-dev-server/client?http://localhost:8080 ./src/app.js

ERROR in ./node_modules/tunnel-agent/index.js Module not found: Error: Can't resolve 'tls' in 'D:\Projects\React Redux News Feed App\node_modules\tunnel-agent' @ ./node_modules/tunnel-agent/index.js 4:10-24 @ ./node_modules/rss-to-json/node_modules/request/lib/tunnel.js @ ./node_modules/rss-to-json/node_modules/request/request.js @ ./node_modules/rss-to-json/node_modules/request/index.js @ ./node_modules/rss-to-json/src/rss.js @ ./node_modules/rss-to-json/index.js @ ./src/actions/channelActions.js @ ./src/app.js @ multi (webpack)-dev-server/client?http://localhost:8080 ./src/app.js webpack: Failed to compile. error `

Kaisaurus commented 6 years ago

Getting similar error trying to use it with gatsbyjs

 ERROR  Failed to compile with 1 errors                                    12:59:43

This dependency was not found:

* fs in ./~/request/lib/har.js

To install it, you can run: npm install --save fs

reinstalling fs didn't solve the problem :(

timothyjellison commented 6 years ago

@deepakkj @Kaisaurus This is a longstanding issue with webpack, not an issue with rss-to-json. rss-to-json has a dependency on request which has a dependency on fs, and webpack requires you to add some config to make sure fs doesn't blow everything up. Specifically, add this object to the root level of your webpack config:

node: {
  fs: 'empty'
}

Here's a more fleshed out example that might be helpful: https://github.com/request/request/issues/1529#issuecomment-271740446

trickydisco78 commented 5 years ago

Did you resolve this @Kaisaurus I'm also running into issues using gatsby. Doesn't look like you can aedit the webpack file in gatsby