Error while trying to deploy page - npm errors - node.js

I am trying to deploy my github page on Cloudfare and I am getting a bunch of errors. I tried installing lating versions od npm and node.js but I really dont understand what I need to do to fix them. Also, looked in my package.json file and I dont have a script for a build. Do I add one, and if so, what do I add to the scripts section? Here is the error message:
ERROR: npm v9.4.2 is known not to run on Node.js v12.18.0. You'll need to upgrade
07:11:10.568 to a newer Node.js version in order to use this version of npm. This version of
07:11:10.569 npm supports the following node versions: ^14.17.0 || ^16.13.0 || >=18.0.0. You
07:11:10.569 can find the latest version at https://nodejs.org/.
07:11:10.569
07:11:10.569 ERROR:
07:11:10.569 /opt/buildhome/repo/node_modules/npm/lib/utils/exit-handler.js:21
07:11:10.570 const hasLoadedNpm = npm?.config.loaded
07:11:10.570 ^
07:11:10.570
07:11:10.570 SyntaxError: Unexpected token '.'
07:11:10.570 at wrapSafe (internal/modules/cjs/loader.js:1054:16)
07:11:10.570 at Module._compile (internal/modules/cjs/loader.js:1102:27)
07:11:10.570 at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
07:11:10.570 at Module.load (internal/modules/cjs/loader.js:986:32)
07:11:10.570 at Function.Module._load (internal/modules/cjs/loader.js:879:14)
07:11:10.571 at Module.require (internal/modules/cjs/loader.js:1026:19)
07:11:10.571 at require (internal/modules/cjs/helpers.js:72:18)
07:11:10.571 at module.exports (/opt/buildhome/repo/node_modules/npm/lib/cli.js:81:23)
07:11:10.571 at Object. (/opt/buildhome/repo/node_modules/npm/bin/npm-cli.js:2:25)
07:11:10.571 at Module._compile (internal/modules/cjs/loader.js:1138:30)
07:11:10.577 Failed: build command exited with code: 1
07:11:11.469 Failed: an internal error occurred
I tried installing latest versions of npm and node.js and waas expecting it to be updated but i am getting the same error.

Related

stt.node version incompatible with electron

I'm getting below error when trying to launch the application.
This is after I deleted node_modules and re-ran npm i to pull packages again
App threw an error during load
node_modules/electron/dist/resources/default_app.asar/main.js:113
Error: Cannot find module '/home/korodarn/projects/mygit/sight-words-solid-electron/node_modules/stt/lib/binding/v1.4.0/linux-x64/electron-v17.4/stt.node'
Require stack:
- /home/korodarn/projects/mygit/sight-words-solid-electron/node_modules/stt/index.js
- /home/korodarn/projects/mygit/sight-words-solid-electron/dist/main/index.cjs
- /home/korodarn/projects/mygit/sight-words-solid-electron/node_modules/electron/dist/resources/default_app.asar/main.js
-
at Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
at Function.n._resolveFilename (node:electron/js2c/browser_init:249:1105)
at Module._load (node:internal/modules/cjs/loader:785:27)
at Function.c._load (node:electron/js2c/asar_bundle:5:13343)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/home/korodarn/projects/mygit/sight-words-solid-electron/node_modules/stt/index.js:24:17)
at Module._compile (node:internal/modules/cjs/loader:1116:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1169:10)
at Module.load (node:internal/modules/cjs/loader:988:32)
I've tried electron-rebuild ( invoked with node_modules/.bin/electron-rebuild ) and it completes successfully but it seems to only rebuild the canvas dependency based on the output.
I am not able to follow the coqui stt documentation well enough to know where to go next.

Testcafe / Jenkins job failing TypeError [ERR_INVALID_ARG_TYPE]: The "original" argument must be of type function. Received undefined

I have a jenkins job that has worked consistently for the past 2 years running various front end tests, but recently I've gotten a stack trace from the job in jenkins that is continuously failing where I'm unsure what to do to fix it. The stack trace is listed below from the job:
TypeError [ERR_INVALID_ARG_TYPE]: The "original" argument must be of type function. Received undefined
at promisify (internal/util.js:279:11)
at Object.<anonymous> (/home/ec2-user/workspace/Sandbox_Verify/node_modules/testcafe-safe-storage/lib/file.js:18:33)
at Module._compile (internal/modules/cjs/loader.js:1076:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:941:32)
at Function.Module._load (internal/modules/cjs/loader.js:782:14)
at Module.require (internal/modules/cjs/loader.js:965:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/home/ec2-user/workspace/Sandbox_Verify/node_modules/testcafe-safe-storage/lib/index.js:30:19)
at Module._compile (internal/modules/cjs/loader.js:1076:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:941:32)
at Function.Module._load (internal/modules/cjs/loader.js:782:14)
at Module.require (internal/modules/cjs/loader.js:965:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/home/ec2-user/workspace/Sandbox_Verify/node_modules/testcafe/lib/dashboard/config-storage.js:3:33) {
code: 'ERR_INVALID_ARG_TYPE'
}
I am facing the same issue. Looks like there was a latest version of testCafe 1.19.0 version released yesterday after which the issue started. If you change your testcafe version to "testcafe": "1.18.6" or remove the ^ it should work. Or may be need to upgrade the nodejs version being used. Got the below warning
npm WARN notsup Unsupported engine for testcafe#1.19.0: wanted: {"node":">=14.0.0"} (current: {"node":"10.24.1","npm":"6.14.12"})
This is due to the testcafe global version. I think
you can check the global version by testcafe --version
and confirm your project installed version -> you can check your package.json file
If both are mismatch means, this issue could occur. So you should set BOTH version to be same
Ex: npm i -g testcafe#1.18.6
In package.json --> testcafe": "^1.18.6
in my case, its works perfectly. and also I have used firefox:headless
The cause of the issue is that you are using an outdated Node.js version.
The crypto.randomUUID function doesn't exist in Node.js 10.24.1.
Please update it to 14.x and all will work correctly.

Composer Rest Server error "async *__getField() {"

I have followed this (https://medium.com/coinmonks/build-a-insurance-application-with-hyperledger-composer-and-react-js-part-1-3ebe7ad54986) tutorial upto "create our REST API".
Now when i run following command
composer-rest-server -c admin#secure-phi -n never -u true -w true
I get following error
/home/ali/.nvm/versions/node/v8.17.0/lib/node_modules/composer-rest-server/node_modules/formdata-node/lib/FormData.js:206
async *__getField() {
^
SyntaxError: Unexpected token *
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
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. (/home/ali/.nvm/versions/node/v8.17.0/lib/node_modules/composer-rest-server/node_modules/#tim-lai/isomorphic-form-data/lib/index.js:2:18)
Is this a syntax related error or something else, and any way to fix this?
I found the error is related to generator not supported below node v8, but hyper-ledger-composer specifically requires node v8, so any work around to this?
It seems to be a version conflict between sub-dependencies in the graph.
Looks like the package 'g11n-pipeline' is requiring a different version of 'swagger-client' that pulls the dependency '#tim-lai/isomorphic-form-data'.
I did this workaround as it is a global package (we don't have access to the package-lock.json/package.json).
Since you've installed with NPM (npm i -g composer-rest-server):
cd /home/ali/.nvm/versions/node/v8.17.0/lib/node_modules/composer-rest-server
npm install swagger-client#3.9.0
rm -rf node_modules/g11n-pipeline/node_modules/swagger-client

SyntaxError: Unexpected token ... in serialport in node_modules

I hav been trying to run the vue-electron app. But the following error comes.
App threw an error during load
C:\newFolder02\pos4-desktop\node_modules\#serialport\stream\lib\index.js:103
const settings = { ...defaultSettings, ...options }
^^^
SyntaxError: Unexpected token ...
at createScript (vm.js:74:10)
at Object.runInThisContext (vm.js:116:10)
at Module._compile (module.js:533:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\newFolder02\pos4-desktop\node_modules\serialport\lib\index.js:1:175)
The error comes from the following line.
const settings = { ...defaultSettings, ...options }
I use following tools
node 8.16.0
npm 6.4.1
electron 1.8.2
It doesn't work in Windows. But it works in Mac OS.
Any idea..?
I have found a solution. You can convert the ES6 code to original JavaScript code with Babel(https://babeljs.io/en/repl).
I converted the ES6 code to vanilla JavaScript through Babel. I ticked ENV PRESET in left sidebar. I set Electron to "1.8" and Node to "8.16". It worked well.
Babel Screenshot

NodeJS Error In Constructor Language Only Present On Ubuntu

I am trying to get a particular npm package to run on Ubuntu 16.04. I am currently running the most up-to-date versions of nodejs and npm, as well as the package (turndown).
Here is the error that I get:
root#ubuntu-s-1vcpu-1gb-nyc1-01:/usr/server# nodejs index.js
/usr/server/node_modules/jsdom/lib/api.js:10
const { URL } = require("whatwg-url");
^
SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at createHTMLParser (/usr/server/node_modules/turndown/lib/turndown.cjs.js:529:17)
at Object.<anonymous> (/usr/server/node_modules/turndown/lib/turndown.cjs.js:537:60)
at Module._compile (module.js:410:26)
The error states it occurs within the "turndown" package and is due to the language in the constructor. What is confusing to me is that this runs on Fedora 27 without error.
What could be causing the difference in behavior?
The answer to this question was to update my version of NodeJS. I ran into another error now, but it is package related.

Resources