Socket io 2.0.4 Cannot find module './utf8' (Heroku) - node.js

I try to install and run a simple app with nodeJs socket io and heroku.When i run the app locally i get no errors but when i try to run the app on heroku i get the following error :
Error: Cannot find module './utf8'
at Function.Module._resolveFilename (module.js:489:15)
at Function.Module._load (module.js:439:25)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/app/node_modules/engine.io-parser/lib/index.js:5:12)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/app/node_modules/engine.io-parser/index.js:2:18)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
Ι navigated with heroku console inside node_modules/enine.io-parser/lib and the utf8.js file was missing.When i downgraded socket-io to version 1.7 the error disappeared.
Is there any solution on how to run socket-io 2.0.4 with Heroku?

Related

node-mysql2: Object.entries is not a function

I am trying to set up nodejs project on Hostgator. But while setting up I am getting the below error. Any help would be really appreciated.
My node version is 16.8.0 and the npm version is 7.21.0
/home/dir/project_folder/node_modules/mysql2/lib/packets/index.js:49
Object.entries(ctorMap).forEach(([name, ctor]) => {
^
TypeError: Object.entries is not a function
at Object.<anonymous> (/home/dir/project_folder/node_modules/mysql2/lib/packets/index.js:49:8)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/dir/project_folder/node_modules/mysql2/lib/connection.js:23:17)
at Module._compile (module.js:577:32)
It is working by replacing node mysql2 with mysql package.

Cannot find module '#babel/runtime/core-js/object/create' Node js Express

I have an express project and its running perfectly on my local machine (Windows).
When i try to deploy it (on ubuntu), i am getting
Error: Cannot find module '#babel/runtime/core-js/object/create'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/var/www/project/node_modules/xregexp/lib/xregexp.js:10:38)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/var/www/project/node_modules/xregexp/lib/index.js:10:39)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/var/www/project/controllers/script.js:3:15)
at Module._compile (module.js:653:30)
I tried npm install babel-runtime --save but it didn't solve anything
hit this issue this morning as well. Are you by chance using xregexp? If so, lock the version to 4.2.0 in your package.json by removing any leading carrot. "xregexp": "4.2.0"
https://github.com/slevithan/xregexp/issues/262
Update: Looks like they have fixed it in 4.2.3.

Node js Watson Speech to text to console Not working

When I started app on windows I get this error:
Error: Module did not self-register.
at Object.Module._extensions..node (module.js:672:18)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\ahmet\node_modules\line-in\index.js:2:20)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
I updated all modules
I updated node
I do everything but still this error

TypeError: Cannot use 'in' operator to search for '$__firebase' in undefined

I'm getting an error importing the Firebase npm module with an app hosted by OpenShift.
The following line
firebase = require('firebase/app'),
produces the following output in the log file
TypeError: Cannot use 'in' operator to search for '$__firebase' in undefined at /var/lib/openshift/57408de67628e1e65b00006a/app-root/runtime/repo/node_modules/firebase/app-node.js:19:449
at Object.<anonymous> (/var/lib/openshift/57408de67628e1e65b00006a/approot/runtime/repo/node_modules/firebase/app-node.js:19:617)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/var/lib/openshift/57408de67628e1e65b00006a/app-root/runtime/repo/node_modules/firebase/firebase-node.js:8:18)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:20:19)
at /var/lib/openshift/57408de67628e1e65b00006a/app-root/runtime/repo/app.js:12:20
The strange thing is that if I execute
$ node app.js
there is no error and the app runs fine.
Try removing the --use-strict option in package.json, if you are using the cartridge with start.js and cluster.
See this stackoverflow q&a for more details on strict mode: in-node-js-how-the-use-strict-statement-is-interpreted
Hope it helps!

rawmemchr: symbol not found in nodegit with docker

When I run the server in the Docker container, everything works fine until I include the line nodegit = require 'nodegit'. If NodeGit is required, on docker-compose up I get the following error:
Error: Error relocating
/usr/myContainer/node_modules/nodegit/build/Release/nodegit.node:
__rawmemchr: symbol not found
I tried NodeGit v.0.12.1 (the latest version) and v.0.11.0.
Without Docker, NodeGit works fine in the same project.
I am new to Docker and virtual machines generally. Any advice on how to troubleshoot this would really help. Thanks!
Update: here are the logs of my container:
[00:22:03] Requiring external module coffee-script/register
[00:22:04] Using gulpfile /usr/lada/gulpfile.coffee
[00:22:04] Starting 'lada-up'...
[00:22:04] Finished 'lada-up' after 23 ms
livereload[tiny-lr] listening on 35729 ...
Error: Error relocating /usr/lada/node_modules/nodegit/build/Release/nodegit.node: __rawmemchr: symbol not found
at Error (native)
at Object.Module._extensions..node (module.js:440:18)
at Module.load (/usr/lib/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (/usr/lada/node_modules/nodegit/lib/nodegit.js:9:12)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (/usr/lib/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (/usr/lada/app/post.coffee:1:11)
at Object.<anonymous> (/usr/lada/app/post.coffee:1:1)
at Module._compile (module.js:413:34)
at Object.loadFile (/usr/lib/node_modules/coffee-script/lib/coffee-script/register.js:16:19)
at Module.load (/usr/lib/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (/usr/lada/app/index.coffee:8:6)
at Object.<anonymous> (/usr/lada/app/index.coffee:1:1)
at Module._compile (module.js:413:34)
at Object.exports.run (/usr/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:134:23)
at compileScript (/usr/lib/node_modules/coffee-script/lib/coffee-script/command.js:224:29)
at compilePath (/usr/lib/node_modules/coffee-script/lib/coffee-script/command.js:174:14)
at Object.exports.run (/usr/lib/node_modules/coffee-script/lib/coffee-script/command.js:98:20)
at Object.<anonymous> (/usr/lib/node_modules/coffee-script/bin/coffee:7:41)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:142:18)
at node.js:939:3

Resources