I am using a Cloud-carbon-footprint-calculator code where the api is in Node.js and client is React.
I have cloned the code in an Azure VM and installed Node.js, npm and Yarn.
Node.js version-v16.17.0
Npm version 8.15.0
Yarn version 3.1.1
I have been able to run the code in Azure VM using "yarn start" and was able to access the app data from server by hitting http://xx.xxx.xx.xx:4000/api/footprint?start=2022-08-19&end=2022-08-19&groupBy=day directly in browser.
I am able to view the client at http:// xx.xxx.xx.xx:3000/, it is hitting the api however after that giving below error.
==============================================================================
The server logs are:
[1] [INFO] 06:26:36 ts-node-dev ver. 2.0.0 (using ts-node ver. 10.8.2, typescript ver. 4.7.4)
[0] (node:6039) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
[0] (Use node --trace-deprecation ... to show where the warning was created)
[0] (node:6039) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
[0] Starting the development server...
[0]
[0] Compiled successfully!
[0]
[0] You can now view #cloud-carbon-footprint/client in the browser.
[0]
[0] Local: http://localhost:3000
[0] On Your Network: http://x.x.x.x:3000
[0]
[0] Note that the development build is not optimized.
[0] To create a production build, use npm run build.
[0]
[0] webpack compiled successfully
[0] Files successfully emitted, waiting for typecheck results...
[0] Issues checking in progress...
[0] No issues found.
[1] 2022-08-24T06:27:46.801Z [server] info: Cloud Carbon Footprint Server listening at http://localhost:4000
[1] 2022-08-24T06:27:53.326Z [api] info: Regions emissions factors API request started
[1] 2022-08-24T06:27:53.335Z [api] info: Footprint API request started.
[1] 2022-08-24T06:27:53.335Z [api] warn: GroupBy parameter not specified. This will be required in the future.
[1] 2022-08-24T06:27:53.340Z [Cache] info: Using local cache file...
==============================================================================
Proxy error: Could not proxy request /api/footprint?start=2021-08-22&end=2022-08-22&limit=90&skip=0 from xx.xxx.xx.xx:3000 to http://127.0.0.1:4000/.
[0] See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNRESET).
I have tried to edit the proxy in package.json in client to add /, use 127.0.0.1/, also the external IP with / but no luck ..
As I am new to React and Node.js, any help is appreciated.
Related
When I try to execute Amplify GraphiQL Explorer via npm run start, it works initially via browser. But when I execute the GraphQL query after for a few seconds I get the following error:
Error:
[0] CredentialsError: Missing credentials in config, if using AWS_CONFIG_FILE, set
AWS_SDK_LOAD_CONFIG=1
[0] at Timeout.connectTimeout [as _onTimeout]
(C:\Users\username\WebstormProjects\configurationservice\node_modules\serverless-plugin-
offline-dynamodb-stream\node_modules\aws-sdk\lib\http\node.js:69:15)
[0] at listOnTimeout (node:internal/timers:559:17)
[0] at processTimers (node:internal/timers:502:7)
[0]
[0] 1 deprecation found: run 'serverless doctor' for more details
[0] npm run local exited with code 1
I dont know the reason and I am concerned about whether I am supposed to use the parameter as well. Any help would be appreciated.
I found the problem. Credentials file in .aws folder should include [default] profile.
Running serverless create --template aws-nodejs --path test in the terminal, I found an error:
C:\Users\p????>serverless create --template aws-nodejs --path test
(node:25984) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)
Environment: win32, node 17.9.0, framework 3.12.0, plugin 6.2.1, SDK 4.3.2
Docs: docs.serverless.com
Support: forum.serverless.com
Bugs: github.com/serverless/serverless/issues
Error:
Could not download template. Ensure that you are using the latest version of Serverless Framework: EPERM: operation not permitted, open 'C:\Users\P????\AppData\Local\Temp\examples\aws-node-env-variables-encrypted-in-a-file\secrets.dev.yml.encrypted'
I have an Ionic project, which works fine on my windows machine and friend's mac, but I got a problem on linux.
The problem appears on ionic serve, it's infinitely Waiting for connectivity with react-scripts..., and appearing continues while it's running. Development server seems to work fine.
Hope, we'll find a solution.
CLI output:
npm run start
> [project name]#0.0.1 start
> ionic serve
> react-scripts start
[react-scripts] ℹ 「wds」: Project is running at http://192.168.1.66/
[react-scripts] ℹ 「wds」: webpack output is served from
[react-scripts] ℹ 「wds」: Content not from webpack is served from /[project path]/app/public
[react-scripts] ℹ 「wds」: 404s will fallback to /
[react-scripts] Starting the development server...
[react-scripts]
[react-scripts] You can now view better-call in the browser.
[react-scripts] Local: http://localhost:8100
[react-scripts] On Your Network: http://192.168.1.66:8100
[react-scripts] Note that the development build is not optimized.
[react-scripts] To create a production build, use npm run build.
[INFO] Waiting for connectivity with react-scripts...
[INFO] Waiting for connectivity with react-scripts...
[INFO] Waiting for connectivity with react-scripts...
[INFO] Waiting for connectivity with react-scripts...
[INFO] Waiting for connectivity with react-scripts...
[INFO] Waiting for connectivity with react-scripts...
[INFO] Waiting for connectivity with react-scripts...
[INFO] Waiting for connectivity with react-scripts...
[INFO] Waiting for connectivity with react-scripts...
I have same issue, because I used node 18, with 16 it's better.
You can resolve it with this:
Install npm i n.
Install older version of node, 16 works fine for me, then install it with this command -> n 16.
Change version of node that you want, just put n in your terminal, and then select the 16 node version, and use ionic serve again
I hope this works for you.
Best
I tried running the latest version of node and postgresql, but was having problem i deprecated node to 13.12.0 and sails-postgresql to 1.0.2 as mentioned in one of the blog. still the error is coming. Stack trace is as below:
sails lift
info: Starting app...
(node:10460) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
info: Initializing apianalytics hook... (requests to monitored routes will be logged!)
info: ·• Auto-migrating... (alter)
info: Hold tight, this could take a moment.
error:
error: Error: Sails is taking too long to load.
Troubleshooting tips:
-• Were you still reading/responding to an interactive prompt?
(Whoops, sorry! Please lift again and try to respond a bit more quickly.)
-• Do you have a lot of stuff in assets/? Grunt might still be running.
(Try increasing the hook timeout. Currently it is 40000.
e.g. sails lift --hookTimeout=80000)
-• Is blueprints a custom or 3rd party hook?
(If initialize() is using a callback, make sure it's being called.)
at Timeout.tooLong [as _onTimeout] (C:\Users\dearm\OneDrive\Desktop\my work\sails-logrocket\myapp\node_modules\sails\lib\app\private\loadHooks.js:191:21)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)
error: Could not load Sails app.
error:
error: Tips:
error: • First, take a look at the error message above.
error: • Make sure you've installed dependencies with npm install.
error: • Check that this app was built for a compatible version of Sails.
error: • Have a question or need help? (http://sailsjs.com/support)
complete code is here https://github.com/mannawar/sails_app
Try using Node version 10 and sails-postgresql version 2.0.0
I found one project on GitHub darkwire and wanted to install it and play with it. Firstly I tried to install it from windows. I installed Node.js and Yarn and I got errors with the command: yarn dev
`C:\darkwire.io-master>yarn dev
yarn run v1.21.1
$ concurrently 'cd client && yarn start' 'cd server && yarn dev'
[0] 'c' is not recognized as an internal or external command,
[0] operable program or batch file.
[1] 'client' is not recognized as an internal or external command,
[1] operable program or batch file.
[0] c exited with code 1
[1] client exited with code 1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`
My next step was to try it in ubuntu 19.10, firstly I installed again Node.js and Yarn and again used: yarn dev. I got an error but now was open site and it not working, just say "Disconnected"
```qq#ubuntu:~/Downloads/darkwire.io-master$ yarn dev
yarn run v1.21.1
$ concurrently 'cd client && yarn start' 'cd server && yarn dev'
$ nodemon src/index.js --exec babel-node
$ react-scripts start
[1] [nodemon] 1.19.0
[1] [nodemon] to restart at any time, enter `rs`
[1] [nodemon] watching: *.*
[1] [nodemon] starting `babel-node src/index.js`
[1] Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
[1] Checking for inactive rooms...
[1] Darkwire is online at port 3001
[1] events.js:183
[1] throw er; // Unhandled 'error' event
[1] ^
[1]
[1] Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
[1] at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1191:14)
[1] [nodemon] app crashed - waiting for file changes before starting...
[0] Starting the development server...
[0]
[0] Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
[0] Compiled successfully!
[0]
[0] You can now view darkwire-client in the browser.
[0]
[0] Local: http://localhost:3000/
[0] On Your Network: http://175.124.13.111:3000/
[0]
[0] Note that the development build is not optimized.
[0] To create a production build, use yarn build.
[0]
```
screenshot
I think maybe I have the wrong version Node.js and try install 9.x version, download again project and try again, it not help, try change port from 3001 to 3000, not help.
From their README.md
Darkwire Server
Darkwire server is a Node.js application that requires redis.
So please install a compatible redis server. Redis tutorial