I have a project in react and gatsby and when I run yarn start, it builds everything for me and starts serving the project on http://localhost:8000. But when I do specific operations, like go to a 404 page or open the Chrome Dev tools, it stops serving the project and return the following error:
gatsby error
ERROR
Cannot read property 'matchPath' of undefined
TypeError: Cannot read property 'matchPath' of undefined
- render-dev-html.ts:144
[web]/[gatsby]/src/utils/dev-ssr/render-dev-html.ts:144:17
- new Promise
- render-dev-html.ts:134 renderDevHTML
[web]/[gatsby]/src/utils/dev-ssr/render-dev-html.ts:134:3
- start-server.ts:502
[web]/[gatsby]/src/utils/start-server.ts:502:40
✨ Done in 290.00s.
I'm using MacOS 11.4 and node/npm version is 12.13.1/6.12.1
I did have a similar issue and it does not happen if I add the following code to gatsby-config.js:
...
flags: {
DEV_SSR: false,
},
...
Related
My app is an API that serves data from a Redis db. It works all fine locally, but once deployed on Vercel I get this error:
undefined ERROR Cannot find module '#redis/client'
Require stack:
- /var/task/node_modules/redis/dist/index.js
- /var/task/helpers/redis.js
- /var/task/models/model.js
- /var/task/routes/routes.js
- /var/task/api.project.js
- /var/task/___now_launcher.js
- /var/runtime/index.mjs
Did you forget to add it to "dependencies" in `package.json`?
Cannot find module '#redis/client'
The app is successfully deployed but it actually fails to run.
I just use the package "redis": "^4.0.2" locally, but i tried to install the specific package #redis/client": "^1.4.2 as well to see if it'd fix the problem in Vercel. But the problem persists.
How to fix this?
I am building a react front Dapp on Ethereum blockchain.
I created it with create react app cmdline.
I have an issue with Metamask extension.
locally when I run my app on my computer everything is ok.
I run it locally with "npm start".
however, when I do "npm run build" to statically serve my app I get the following at first loading in the browser :
Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.
Then when I refresh the page the error disappears and everything works well.
Some chrome extension devs are having same error with extensions. They solve it by handling the fact that the extension is not answering but in my case I use ethers.js library and I think a way to solve my issue is in the loading process of my app
the error appears when I make an async req to the Metamask extension :
const accounts = await ethereum.request({ method: 'eth_accounts' });
Any help please ?
EDIT
the issue is that the js scripts output from 'npm run build' command are written in the wrong place in the 'index.html' file generated by 'npm run build'(at the bottom)
When I manually put theses js scripts at the top of the 'index.html' file then my app is working.
But, I still need to find a solution to dynamicaly do this modification in the build process :
either an option argument in 'npm run build'
OR
a custom script to parse and modify the generated 'index.html'
any solution please ?
I've started the Realm-provided realm-electron-advanced-quickstart found here.
Everything works fine when running in dev, but when I package this with electron-builder, the app does not work. I moved createWindow() to the top of the app.whenReady() function so I could see the debugger, and it showed the following message:
Failed to open realm: Error: illegal operation on a directory
at run (renderer.js:26)
at renderer.js:39
Line 26 is
const realm = new Realm(config);
I suspect this is some sort of path/permissions issue with the .realm file.
In main.js, I changed the path in the realm config to
path.join(app.getPath("home"),"my.realm")
But I could not do so on renderer.js.
I would appreciate any ideas or examples of how this has been implemented before.
I'm running Node v14.15.4.
I have a Swagger NodeJS project which was created using Swagger
Swagger uses swagger-connect 0.1.0 out of the box but I've now upgraded to swagger-connect 0.7.0 using the manual instructions which included adding the following to config/default.yml:
_swagger_params_parser: # <= Add this definition
name: swagger_params_parser
jsonOptions: {}
urlencodedOptions:
extended: false
multerOptions:
inMemory: true
textOptions:
type: "*/*"
and under section 'swagger_controllers:' I've added :
- swagger_params_parser
This works gloriously on my local machine but when I push to the server it throws the error:
Error initializing middleware
May 22 13:25:27 myserver "myapp": Error: Cannot find module '/var/www/myapp/node_modules/swagger-connect/node_modules/swagger-node-runner/node_modules/bagpipes/lib/fittings/swagger_params_parser'
I'm starting the server via:
node app.js
So it looks like a potential dependency bleed on my local machine but I've destroyed (rm -Rf) 'node_modules' and re-run npm install and it still works fine on my local machine but breaks on the server.
Any ideas why swagger-params-parser is missing?
Also, another weird thing is that swagger-params-parser doesn't exist locally in directory '/var/www/myapp/node_modules/swagger-connect/node_modules/swagger-node-runner/node_modules/bagpipes/lib/fittings/swagger_params_parser' and yet locally it works!?
The issue turned out to be a stray node_modules directory on the server (we normally use node_modules_production).
Two things I've learned from this:
1.) node_modules is used instead of node_module_production if it exists. My RPM was not overwriting the directory and hence left an old copy of node_modules which was incorrectly packaged up at some point. The swagger app was loading modules from node_modules and not node_modules_production
2.) swagger_params_parser is indeed missing, even on the working version of the code so it looks like this error:
Error initializing middleware
May 22 13:25:27 myserver "myapp": Error: Cannot find module '/var/www/myapp/node_modules/swagger-connect/node_modules/swagger-node-runner/node_modules/bagpipes/lib/fittings/swagger_params_parser
is misleading, as that module is never present, at least in version 0.7.0 of swagger-connect
I am using Ubuntu 16.04 x 64 and I'm running into an issue -
When I run my Keystone JS app manually by typing in "node keystone", the app runs fine and I can view it in my browser like normal.
However, when I start the app using pm2, the app fails immediately and restarts consecutively.
I think it is because keystonejs has a known "error" that is not a real error, but just a warning when it starts.
From the "keystone-out-0.log" file -
Error ...node_modules/bson/build/Release/bson.node: invalid ELF header
However, in the "keystone-error-0.log" file, it gives me a different error that does not occur when I run it manually -
Error: ENOENT: no such file or directory, open '.env'
Any one faced anything similar?
Thanks