NestJS create new project failed on MacOS [duplicate] - node.js

This question already has an answer here:
NestJS CLI outputs garbage
(1 answer)
Closed last year.
I'm currently using macOS 10.14.6(Mojave). When I started to create new nestjs by the cli nest new prj, I got this problem and can not figure out what happened? What is the problem and how can I fix this issue?

This is a bug in colors.js. Nest uses this library to color the console info. Adding this in package.json should fix it:
"resolutions": {
"colors": "1.4.0"
},
Read more about it here: https://github.com/Marak/colors.js/issues/285

Resolutions fix didn't seem to work for me. But this does:
npm install colors#1.4.0

Related

Webpack loading wrong version of Node Module for Angular project

I have a project in Angular 13. I want to use quillJS and I want to add tables so I tried to install quill-better-table in my project.
For some reason the package is not working. I used the web inspector and found this to be the issue:
ERROR TypeError: quill.keyboard.bindings.Backspace is undefined
The problem seems to be located at: quill_better_table_BetterTable quill-better-table.js:2979 and when I check the debugger I can see the line:
let thisBinding = quill.keyboard.bindings['Backspace'].pop();
quill.keyboard.bindings['Backspace'].splice(0, 1, thisBinding); // add Matchers to match and render quill-better-table for initialization
// or pasting
I found a github repo that had this issue fixed:
https://github.com/LosEcher/quill-better-table
The problem I'm running into is I dont know how to get that particular repo into my project. I have tried updating the current package and webpack continues to load the old one. I've tried clearing the npm cache and reinstalling the node packages.
I found this guide: https://whatapalaver.co.uk/npm-dependency which seems to indicate what I should do but I'm not quite npm literate enough to figure it out. Specifically, I dont know that I understand how to create the NPM link.
I'm looking for advice as to how to fix this package. I am going to be reading up on NPM link but I figured if there was another easier way to get this fixed then I would ask. I can load that repo into my node module folder, but I dont know how to make webpack reload the updated module.
Thanks in advance for the help, let me know what details I for got to add.

Testing expo with enzyme: jest-environment-enzyme does not export getVmContext

I'd like to use enzyme to test my React-Native components in Expo managed project.
I follow the docs for jest-expo-enzyme, but now I get:
Test environment found at "/Users/raarts/myproject/node_modules/jest-environment-enzyme/lib/index.js" does not export a "getVmContext" method, which is mandatory from Jest 27. This method is a replacement for "runScript".
My guess from here is that jest-environment-enzyme (last release 2 years ago), somehow needs to be updated for jest 27, but given jest-expo-enzyme was released 2 months ago, I figured I must be doing something wrong. Clueless on how to proceed.
Anybody has any advice?
This is a bug in enzyme. A workaround is provided in this comment.
The solution is to force upgrade jest-environment-jsdom package.
The better way to do it is via resolutions, if you are using Yarn, add this to your package.json:
"resolutions": {
"jest-environment-jsdom": "27.4.6"
},
Check for the latest version of jest-environment-jsdom and change it if necessary.
You can also do this in classic NPM using the npm-force-resolutions package.
Note: you may encounter other problems after fixing this one, if you get a setImmediate error see this comment
I am working on Next js project and using Jest and enzyme for testing, and for me I was able to fix this error by changing
testEnvironment: 'enzyme',
to
testEnvironment: 'jsdom',
in jest.config.js file.

SyntaxError: Unexpected token '??=' Discord.JS Heroku [duplicate]

This question already has an answer here:
Discord bot on Heroku throws an error: agent ??= new https.Agent
(1 answer)
Closed last year.
When I deploy my Branch I get this error in logs
Here is the console log
Anyone can help me fix this?
Nullish assignment is first supported in Node 15. It sounds like whatever version of Node your app is using is not to that point yet.
Specify a more recent Node version for Heroku to run in your package:
"engines": {
"node": "16.x"
otherwise it uses 14 by default (which is a slightly older LTS version which does not support this relatively new syntax).

NodeJS-MSMQ: SyntaxError: Cannot use import statement outside a module

I'm pretty new with NodeJS and I'm trying to use a module called "updated-node-msmq" (from this repository) in my project but getting an error.
What I've done:
I opened a new folder for the project.
I used the command "$ npm install --save updated-node-msmq" and got some warnings (Screenshot attached).
When I try to use the module according to the README, and run my "test.js" file I got the following error here in the screenshot).
I am using version 14.16.0 of NodeJS and after trying to fix this myself I realized that probably the problem is that the module was built for older versions of NodeJS.
I understand that low version is not a recommended solution, but I have no clue how to update a module.
Help / guidance in solving the problem?
Thanks in advance everyone!
Why are you using updated-node-msmq? That package seems like a mess, and the errors you are getting is because the whole module is written with ES2015 but doesn't seem to have been transpiled to node.js compatible code before published to NPM.
I'd advise you to use a tried and tested module for MSMQ first and foremost.
EDIT: Seems like the author fucked up in the 0.2.0 version. You could use the 0.1.9 (by instead using npm install updated-node-msmq#0.1.9 but that one is 3 years old.

org.mockito cannot be resolved to a module [duplicate]

This question already has answers here:
How do I open packages and require dependencies on test scope modules only for JUnit testing
(2 answers)
Closed 3 years ago.
I am getting this error in eclipse:
"org.mockito cannot be resolved to a module" in module-info.java
I have tried with an upgraded version of mockito-core.jar 3.0.0 but problem not resolved. Eclipse version is : 2018-12 (4.10.0)
module somemodule {
exports abc.changer;
requires spring.boot;
requires spring.boot.autoconfigure;
requires org.mockito;
}
Any suggestions on how to fix this?
we can resolve it with separate modules eg module-info.java and module-info.test. it require maven-compiler-plugin 3.8.x. for complete solution plese go to https://sormuras.github.io/blog/2018-09-11-testing-in-the-modular-world.html

Resources