Getting an error when running "npx wdio config" - node.js

I get the following error when I try to set up "Hello World" test suite into my project by running: "npx wdio config". I followed the instructions on the https://webdriver.io/docs/gettingstarted and still not able to get it to work.
Can someone help me with resolving this:
WDIO Configuration Helper
? Where is your automation backend located? (Use arrow keys)
❯ On my local machine
In the cloud using Experitest
In the cloud using Sauce Labs
In the cloud using Browserstack or Testingbot or LambdaTest or a different service
I have my own Selenium cloud (node:2831) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'find' of undefined
at Object.run (/Users/gustavosuarez/web/mo-appium-wdio-jasmine/node_modules/#wdio/cli/build/index.js:67:19)
at Object.<anonymous> (/Users/gustavosuarez/web/mo-appium-wdio-jasmine/node_modules/#wdio/cli/bin/wdio.js:11:21)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47

Seems to be a problem with the latest version of the #wdio/cli dependency. I solved the problem by using an older version and it works now ("#wdio/cli": "7.3.1"). Just add that dependency to your package.json and run yarn or npm install again, then npx wdio config and it should work.

Related

NextJS build error - ReferenceError: navigator is not defined

I'm running into this special error message while trying to build a simple NextJS application (using npm run build):
> Build error occurred
ReferenceError: navigator is not defined
at /cdk-next/next-frontend/node_modules/codemirror/lib/codemirror.js:18:19
at /cdk-next/next-frontend/node_modules/codemirror/lib/codemirror.js:11:83
at Object.<anonymous> (/cdk-next/next-frontend/node_modules/codemirror/lib/codemirror.js:14:2)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/cdk-next/next-frontend/node_modules/easymde/src/js/easymde.js:2:18) {
type: 'ReferenceError'
}
info - Collecting page data .
I don't know who codemirror is, or why it's not letting me build my project. From reading around I gather that this issue occurs with NextJS when trying to build a project on the server side instead of the client side, because the project does not have access to a window or navigator. In that case, what should I do? The tutorial I'm following seems to breeze through this step just fine, so should I just look at their package.json and downgrade all of my packages? Any advice would be appreciated.
The error was with my import of import SimpleMDE from "react-simplemde-editor" (located in create-post.js of the repo link above).
I implemented the solution proposed by modikum here: https://github.com/dabit3/next.js-amplify-workshop/issues/21.
Now the project builds successfully.

Issues with Sharp in Azure functions

Hi I have been trying to deploy my code for resizing image streams in azure function.
It seems to be working perfectly fine in local, even deployment via VS code is successful.
But when I try to trigger the function, I get below exception.
Relatively new to both nodejs and azure, any suggestions?
2021-06-08T04:51:24.370 [Information] Executing 'Functions.HttpTrigger1' (Reason='This function was programmatically called via the host APIs.', Id=7bd3aba0-8833-4ffe-b2c7-a061533fef6a)
2021-06-08T04:51:24.444 [Error] Executed 'Functions.HttpTrigger1' (Failed, Id=7bd3aba0-8833-4ffe-b2c7-a061533fef6a, Duration=17ms)
Result: Failure
Exception: Worker was unable to load function HttpTrigger1: 'Error: 'win32-x64' binaries cannot be used on the 'win32-ia32' platform. Please remove the 'node_modules/sharp' directory and run 'npm install' on the 'win32-ia32' platform.'
Stack: Error: 'win32-x64' binaries cannot be used on the 'win32-ia32' platform. Please remove the 'node_modules/sharp' directory and run 'npm install' on the 'win32-ia32' platform.
at Object.hasVendoredLibvips (C:\home\site\wwwroot\node_modules\sharp\lib\libvips.js:82:13)
at Object.<anonymous> (C:\home\site\wwwroot\node_modules\sharp\lib\constructor.js:7:22)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\home\site\wwwroot\node_modules\sharp\lib\index.js:3:15)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
According to the error message, we need to update Azure function as 64 bit Platform. Regarding how to do that, please refer to here.

Google Cloud Function not recognizing Papaparse 5.0 Dependency

I am building a Node.js Google Cloud function, and it is not recognizing the dependency "papaparse":
in package.json
"dependencies": {
"papaparse": "^5.0.0",
"twilio": "^3.33.2"
}
Error code I am getting:
Function failed on loading user code. Error message: Code in file index.js can't be loaded.
Did you list all required modules in the package.json dependencies?
Detailed stack trace: Error: Cannot find module 'papaparse'
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> (/srv/index.js:8:14)
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)
I have tried reinstalling papaparse, running npm audit, but those steps haven't helped.
Does anyone know why this would happen?
I just managed to deploy a Cloud Function with papaparse.
For this you just need to deploy your function from the Cloud Shell. First create a folder where you gonna insert all your files. Then clone the repo from the papaparse github with the command git clone into that folder.
Now after adding your Index.json and your Package.json you can deploy your Cloud Function following this Deploying from Your Local Machine documentation.

internal modules cjs is not working after yarn upgraded to 1.13.0

I have a react app which is based on react boilerplate. I am running the
following command:
cross-env NODE_ENV=development node --experimental-modules ./server/index.mjs
After upgrading yarn to 1.13.0, I am getting the following error:
(node:11137) ExperimentalWarning: The ESM module loader is experimental.
internal/modules/cjs/loader.js:677
module.reflect.onReady((reflect) => {
^
TypeError: Cannot read property 'onReady' of undefined
at Module.load (internal/modules/cjs/loader.js:677:22)
at tryModuleLoad (internal/modules/cjs/loader.js:606:12)
at Function.Module._load (internal/modules/cjs/loader.js:598:3)
at Module.require (internal/modules/cjs/loader.js:705:19)
at require (internal/modules/cjs/helpers.js:14:16)
at Object.<anonymous> (/Users/mdjahidulislam/workspace/ifs/frontend/node_modules/psl/index.js:14:19)
at Module._compile (internal/modules/cjs/loader.js:799:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:810:10)
at Module.load (internal/modules/cjs/loader.js:666:32)
at tryModuleLoad (internal/modules/cjs/loader.js:606:12)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Seems like module.reflect is undefined. In which scenario it can be undefined and how I can solve the problem.
Thanks in advance for any help and suggestions.
Finally solved it. It was all about nodejs version. I had nodejs version 11.* and then I downgraded it on 10.* and it solved the issue.

can not run functions.config() locally after updating to the latest firebase tools 3.17.3 / 5.8.1

I have very simple "Node.js functions.config()" code that reads simple property value.
const smtpEmail = functions.config().smtp.email;
The code was functioning with earlier Firebase versions, however after updating to the latest firebase tools v"3.17.3" and firebase-admin "5.8.1", firebase-functions "0.8.1", I got a weird stubborn parse error with functions.config()
I ran firebase functions:config:get > .runtimeconfig.json multiple times inside the functions directory, but I still got Firebase complaining with the following error message when I try to run the functions locally.
! functions: Failed to load functions source code. Ensure that you have the latest SDK by running npm i --save firebase-functions inside the functions directory.
! functions: Error from emulator. FirebaseError: Error occurred while parsing your function triggers.
TypeError: Cannot read property 'email' of undefined
at Object.<anonymous> (D:\android-projects\firebase\functions\index.js:85:42)
at Module._compile (module.js:570:32)
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 Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at C:\Users\GIGABYTE\AppData\Roaming\npm\node_modules\firebase-tools\lib\triggerParser.js:18:11
at Object.<anonymous> (C:\Users\GIGABYTE\AppData\Roaming\npm\node_modules\firebase-tools\lib\triggerParser.js:38:3)
This is the format of the generated ".runtimeconfig.json" file.
{
"smtp": {
"email": "myemail#domain.com",
"password": "password"
}
}
This problem should be resolved with CLI version 3.17.4.

Resources