Routing and custom widget issues after upgrading dojo and node versions - node.js

We are facing couple of issue with dojo framework after we upgrade our node and npm version, please find the details below and it will be of great help if you could please provide inputs on how this can be resolved
Application structure: We are using dojo framework application build on node and npm, we are using grunt along with dojo and npm node modules
Issue: We started facing issues with grunt 2 months back without any changes to our code, we were not able to do npm install, logs were provided below for your reference
issue logs:
--------------------------------------------------------------------------------------
module.js:478
throw err;
^
Error: Cannot find module 'has'
at Function.Module._resolveFilename (module.js:476:15)
at Function.Module._load (module.js:424:25)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (...\v6.14.4\node_modules\grunt-cli\node_modules\is-core-module\index.js:3:11)
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)
--------------------------------------------------------------------------------------
module.js:478
throw err;
^
Error: Cannot find module 'ini'
at Function.Module._resolveFilename (module.js:476:15)
at Function.Module._load (module.js:424:25)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/jenkins/workspace/module/node_modules/global-prefix/index.js:14:11)
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)
--------------------------------------------------------------------------------------
Version we were using:
node: 6.14.4
npm: 3.10.10
grunt-cli: 0.1.13
python: 2.7
Visual studio: 2013
dojo node modules we were using:
"dijit": "dojo/dijit#1.9.9"
"dojo": "dojo/dojo#1.9.9"
"dojo-util": "dojo/util#1.10.4"
"dojox": "dojo/dojox#1.9.9"
Based on the suggestions received we have upgraded node and npm version along with grunt, dojo and some of the other node modules, please find the version we upgraded to
node: 16.13.2
npm: 8.19.3
grunt-cli: 1.4.3
python: 3.10
Visual studio: 2022
dojo node modules we updated:
"dijit": "^1.17.3"
"dojo": "^1.17.3"
"dojo-util": "^1.17.3"
"dojox": "^1.17.3"
After the above upgrade changes we are seeing couple of issues with routing and custom widgets
Issue 1:
We are using router.go function to navigate between pages, here we implemented replacements and query as parameter but from one of our view the navigation is not working, though the url path is getting changed on click of button the page is not refreshed and still shows the existing one, it stays on same page if same button is clicked but when other button is clicked the url path changes and navigation happens this time, issue is only with first time navigation and the same router.go implementation is working in other places in application.
We have tried resetting the router, reinitializing and reload, but reloading is refreshing whole page which is not a considerable solution.
Issue 2:
We have a multiselect calendar to select date with right and left arrows using custom widget dijit base css, we have writter our own implementation with table, tr and td, after the upgrade the table classes are not getting applied and calendar format is broken
Any inputs of suggestions here are much appreciated or if you can please provide what was changed between the versions we upgraded (might be some documentation if we can find some where, we tried looking at dojo community but couldn't find any) please reply if you need further information, Thanks a lot in advance.
We have tried resetting the router, reinitializing and reload, but reloading is refreshing whole page which is not a considerable solution.

Related

TypeError: hammerhead.extend is not a function

Don't know why I'm experiencing the following inside the package testcafe-hammerhead.
stiva#stiva-ThinkPad-T490:~/AC_Automation$ testcafe --version
Using locally installed version of TestCafe.
/home/stiva/AC_Automation/node_modules/testcafe-hammerhead/lib/utils/logger.js:44
const proxyLogger = hammerhead.extend('proxy');
^
TypeError: hammerhead.extend is not a function
at Object.<anonymous> (/home/stiva/AC_Automation/node_modules/testcafe-hammerhead/lib/utils/logger.js:44:32)
at Module._compile (node:internal/modules/cjs/loader:1091:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1120:10)
at Module.load (node:internal/modules/cjs/loader:971:32)
at Function.Module._load (node:internal/modules/cjs/loader:812:14)
at Module.require (node:internal/modules/cjs/loader:995:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (/home/stiva/AC_Automation/node_modules/testcafe-hammerhead/lib/request-pipeline/context.js:24:34)
at Module._compile (node:internal/modules/cjs/loader:1091:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1120:10)
I have updated testcafe-hammerhead to its latest, 24.2.1 but it still happens whenever i try to use testcafe for anything.
I cannot reproduce this issue with the basic local TestCafe installation. Try deleting your dependencies and your "lock" file and install all dependencies again. Please note that you don't need to update the testcafe-hamemrhead dependency manually in your project, just install the latest TestCafe version. If the issue still appears, please open a new bug report with a complete example using this template.

A module does not compile in a newer node.js version, any workarounds?

my open-source project depends on a lemmatization module —
https://github.com/grachev/node-lemmer
— which needs to be compiled before it can run.
After updating to a newer version of node.js I can't run this module, because it needs to be re-compiled. Usually this was done when I simply did npm install node-lemmer however it is now not available in npm and I don't know how to compile it under that new node version and why I have to do it at all...
I tried running npm rebuild but it does not recompile – too many errors. The issues folder of that project on GitHub has the issue up already but there's no fix for it...
What could I do about it? Why do I need to recompile this module when I install a new version of node? Is there a workaround? Could I "trick" node or that module so it doesn't need to recompile? Or maybe it's possible to compile it manually?
...
Some mode details:
I used to run my project on node 0.8.3 vesion and then switched to the new 8.8.0 version. Now when I try to run my project under the new node version it doesn't start giving the following error:
module.js:641
return process.dlopen(module, path._makeLong(filename));
^
Error: Module did not self-register.
at Object.Module._extensions..node (module.js:641:18)
at Module.load (module.js:531:32)
at tryModuleLoad (module.js:494:12)
at Function.Module._load (module.js:486:3)
at Module.require (module.js:556:17)
at require (internal/module.js:11:18)
at Object.<anonymous>
(/path-to-my-project/node_modules/node-lemmer/lib/node-lemmer.js:1:82)
at Module._compile (module.js:612:30)
at Object.Module._extensions..js (module.js:623:10)
at Module.load (module.js:531:32)
which is an error I've seen before because my module could not be compiled.
my project is https://github.com/noduslabs/infranodus in case it helps to see the source code.

Creating a dev environment from existing website with nodejs

So I've used Node.js in the past before, but I've never created a development environment from a pre-existing website. And now I have to. Plus, the previous developer worked in another state and used an iMac and developed in Coda. We were able to get all the files to my current workspace but I am trying to create the project in Visual Studio with Node Tools and am running into an issue. I fairly certain that its some kind of routing/config/setup issue but have not been able to suss it out and I've been rooting through package.json and config files for days.
All files are in the same relative directory from the root yet, and I've updated all packages and adjusted the code accordingly (I believe for the updated packages). However, when I try to start the site up, I run into this issue.
Debugger listening on [::]:5858
T:\IT\Website\ComfortCo(Dev)\ComfortCo(Dev)\views\index.jade:1
(function (exports, require, module, __filename, __dirname) { extends global_layout
^^^^^^^
SyntaxError: Unexpected token extends
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Timeout.Module.runMain [as _onTimeout] (module.js:604:10)
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)
Press any key to continue...
The site uses jade with express and this is a pretty basic function of jade layouts. So I do not know why there is a Syntax Error.
Any ideas?
Update
So I was told that I did not have the most up-to-date versions of Node except I installed the most current version of Node when I installed Node Tools for VS and the pathing is correct.
However, when I ran npm list and npm list -g they came back with nothing even though my projects npm repository shows a whole list of packages installed and up-to-date. So I can only conclude that their is some pathing issue here. However, I have never configured Node paths. I've always just left them default. Any guidance here?
The extends keyword is supported since Node version 4.x - see:
http://node.green/#ES2015-functions-class-extends
It seems that you may be running an older version of Node but of course it's hard to tell because you provided no information about your runtime environment whatsoever.

Issue with gulp trying to run an example - 'The super constructor to `inherits` must not be null or undefined.'

I'm trying to run an example, but I'm getting the following error when I try to gulp. I'm pretty new to node, so any direction or help would be very appreciated. The install went without any issues, seemingly.
$ nvm exec 4.2.2 gulp
Running node v4.2.2 (npm v2.14.7)
util.js:756
throw new TypeError('The super constructor to `inherits` must not ' +
^
TypeError: The super constructor to `inherits` must not be null or undefined.
at Object.exports.inherits (util.js:756:11)
at Object.<anonymous> ([working directory path]/node_modules/browser-sync/node_modules/http-proxy/lib/http-proxy/index.js:108:17)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> ([working directory path]/node_modules/browser-sync/node_modules/http-proxy/lib/http-proxy.js:4:17)
at Module._compile (module.js:435:26)
It seems this issue has come up in different contexts before but was unanswered:
1) Mean.io application is throwing error with forever
2) https://github.com/rajaraodv/rabbitpubsub/issues/4
Seems to be a fairly recent issue and it seems to not have to do with http-proxy.
Turned out to be a problem with an older version of browser-sync. Once that was updated, this started to work.
Try an older version of Node. The example's package.json specifies Node 0.10 in the engines section, which suggests the initial code may have been written for that version.

How do I start ultra-repl

I'm using node js v0.12.4 on Win 8 and I have installed ultra-repl using:
npm install ultra-repl
How do I start it? I've tried to start using:
node ultra-repl.js
but I get the error:
d:\Development\Private\WorkspaceServer\messaging\node_modules\ultra-repl\lib\ScopedModule.js:81
if (NativeModule.exists(request)) {
^
TypeError: Cannot read property 'exists' of undefined
at Function._resolveFilename (d:\Development\Private\WorkspaceServer\messaging\node_modules\ultra-repl\lib\ScopedModule.js:81:21)
at Function._load (d:\Development\Private\WorkspaceServer\messaging\node_modules\ultra-repl\lib\ScopedModule.js:102:33)
at Object.<anonymous> (d:\Development\Private\WorkspaceServer\messaging\node_modules\ultra-repl\index.js:3:30)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (d:\Development\Private\WorkspaceServer\messaging\node_modules\ultra-repl\bin\ultra-repl.js:2:18)
Update:
Unfortunately, this no longer works since arguments.callee.caller was deprecated.
Does this mean that ultra-repl is not working at all anymore?
It seems to be broken since at least v0.12.2.
There's an open bug report on Github, but no workaround reported yet.
( I just realised you commented on that bug report, so you obviously already know about it. I'll leave the link in my answer for the sake of others, though. )
If you're willing to use an earlier version of node, you could install one with NVM* and try installing ultra-repl for that version.
* Note: NVM doesn't support Windows, but there are a couple of alternatives for Windows (which seem to share the same interface) linked on its page.

Resources