I found the question How to use optional chaining in Node.js 12.
And there's a problem, it doesn't work in my vite#2.4.4 project. It actually works fine on iphone12, but doesn't work in my another android mobile.
Then I used edge://inspect debugging to find this:
Uncaught SyntaxError: Unexpected token .
// const serverResponseCode = response.data?.code;
How should I configure my Vite?
Related
I'm attempting to run music21j in node js ( repo link , npm link ).
I get ReferenceError: self is not defined
When trying to simply initialize music21j:
const music21 = require('music21j');
const n = new music21.note.Note('F#');
Does this mean it's not possible to run outside of the browser, or am I somehow initializing to the wrong environment?
The github documentation states
...or use it in your javascript/typescript project
, hence my confusion.
From the github repo:
At present it's not possible to run outside of the browser. :-( But we're working on removing certain JQuery patches that should make it easier to do. You may however need to use ES6-style imports.
we usually use below statement to use authy library in node file using js ,mostly by require statement !
const authy = require('authy')('API KEY');
I've moved my code to nest eco system and now How should i do the same using typescript ,as i also want to pass API Key to it ?
I've tried below code as well ,but still it's not working
import { authy } from 'authy'(API KEY)
suggest something !
I have faced a similar issue in my NestJS project when using twillio library.
Currently, I have resolved this by importing it this way:
import authy = require('authy');
If, this doesn't work for you (for any reason e.g. TypeScript compile error), then can you try the following import statement?
import * as Authy from 'authy';
Also, let me know which one works for you.
I built an app a long time ago using Firebase and dialogflow-javascript-client.
Now, dialogflow-javascript-client is deprecated. Since dialogflow-nodejs-client-v2 is a node.js client, it is not supposed to run on Angular. Did they drop the javascript support? I can't get any answer from the devs, they just seem to avoid it.
If it is not possible, my only solution is to drop support of Dialogflow in my app.
There is absolutely not documentation or info for users migrating from Javascript, here is the only thing they give you:
Off course I tried to run it anyway, thinking it was also built to run on javascript...
But here is what I get:
WARNING in
./node_modules/google-gax/node_modules/grpc/node_modules/node-pre-gyp/lib/util/versioning.js
17:20-67 Critical dependency: the request of a dependency is an
expression
WARNING in
./node_modules/google-gax/node_modules/grpc/node_modules/node-pre-gyp/lib/pre-binding.js
20:22-48 Critical dependency: the request of a dependency is an
expression
WARNING in
./node_modules/google-gax/node_modules/grpc/src/grpc_extension.js
32:12-33 Critical dependency: the request of a dependency is an
expression
WARNING in
./node_modules/google-gax/node_modules/grpc/node_modules/minimatch/minimatch.js
Module not found: Error: Can't resolve 'path' in
'D:\ng\ww-app\node_modules\google-gax\node_modules\grpc\node_modules\minimatch'
WARNING in ./node_modules/minimatch/minimatch.js Module not found:
Error: Can't resolve 'path' in 'D:\ng\ww-app\node_modules\minimatch'
ERROR in ./node_modules/dialogflow/src/v2/agents_client.js Module not
found: Error: Can't resolve './agents_client_config' in
'D:\ng\ww-app\node_modules\dialogflow\src\v2'
.... (many more following)
The dialogflow-nodejs-client-v2 only supports a node.js environment. To update your agent to V2, you should create a Cloud Function for Firebase that sends requests to dialogflow-nodejs-client-v2, then call that Cloud Function from your Angular code rather than calling the API directly.
There is a major benefit of this approach: you will no longer have your API credentials exposed on the client side, which is a security risk.
I read a tutorial once with Node.js, maybe you can migrate your data from angular to Node.js like in this question anwered before.
I found another solution:
I've created a javascript client... and I get token from nodejs api getToken endpoint when it expires (that is every hour)... I have restricted the getToken endpoint to the same domain.
I'm building an electron app that needs an open/save dialog window.
I'm following this guide online: Standard Dialogs in Electron which uses the remote package.
I'm getting a syntax error with one of the dependency files within the remote package, shown below:
Unexpected token >: node_modules/remote/libs/remote.coffee:8
Line 8 is module.exports = (opts = {}) ->, probably supposed to be =>. If I change that, I get an Unexpected identifier error instead. This leads me to think there's some kind of ES6 support issue here.
Are there any troubleshooting steps I could take to help narrow down the issue?
Or alternatively, suggestions for a different electron-compatible package for open file/save file dialog windows (mac).
This error was caused by an update issue regarding the require syntax. The solution is the following:
// use these lines instead to set up dialog instead of the remote package.
const remote = require('electron').remote;
const dialog = remote.dialog;
Fix courtesy of this Github comment
I am using angular-cli for a MEAN stack application. It was working fine till yesterday, but today I am getting,
WARNING in ./~/mongoose/lib/drivers/index.js
8:11-74 Critical dependency: the request of a dependency is an expression
on ng build.
And if i still proceed and run the application i get,
Uncaught TypeError: __webpack_require__.i(...) is not a function
at Object.260 (main.bundle.js:913)
at __webpack_require__ (inline.bundle.js:53)
at Object.142 (main.bundle.js:11)
error on,
var User = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_mongoose__["model"])("User", UserSchema);
in main bundle.
My ts file where this code is,
export const User: Model<IUser> = model<IUser>("User", UserSchema);
I searched on net and tried many things but had no luck.
Also some posts are suggesting to run web pack,but this was working till yesterday where I had no web pack.
I also hardcoded the mongoose's version value by removing caret from pacakge.json, had no luck again.
I made a different typescript class for entity model that is to be used on UI(angular 2) side.
Earlier was using the schema class as model in my UI too, hence was getting this error.