my quokka vs code extension is not working - javascript

it shows the following in the output :
​​​​​Quokka 'js.js' (node: v13.14.0, plugins: jsdom-quokka-plugin)​​​​
  Unexpected token '?'  ​​​​​at ​​​​​​​​Object.compileFunction​​​
​vm.js:344​
I was trying to run the extension and to get the desired output by running the extension.

Related

Very simple Javascript - trying to console.log an array of objects - not working?

Beginner here working with Javascript inside a script.js file in Visual Studio.
I wrote the following code to declare an array of objects and then console log the whole thing:
let frenchDictionary = [
{
"french": "qui",
"english":"who"
},
{
"french": "toujours",
"english":"always"
}
]
console.log(frenchDictionary)
But VS terminal throws the following error: frenchDictionary : The term 'frenchDictionary' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Why isn't it recognizing frenchDictionary as a variable?
Seems like you are trying to console log that from the PowerShell or something. Try typing this in the terminal:
node - NAME OF YOUR JAVASCRIPT FILE.js -

GCP: ymal environment variable format for app engine

I'm trying to deploy my web app to App Engine in GCP. I have my API key and Client key stored in my app.yaml file. but when I try to deploy my app I'm getting this error:
ERROR: (gcloud.app.deploy) An error occurred while parsing file:
[C:\app.yaml]
Value 'API-KEY' for key in EnvironmentVariables does not match expression '^(?:
[a-zA-Z_][a-zA-Z0-9_]*)$'
in "C:\app.yaml", line 4, column 12
and here is my app.yaml file:
runtime: nodejs
env: flex
env_variables:
API-KEY: 'ExampleAPIKey'
CLIENT_ID: 'example123-clientkey1234567890.apps.googleusercontent.com'
I tried to remove the '' but I got the same error message. I don't know what I'm missing here.

Access to script blocked by CORS policy

I am making a simple test project including 2 JavaScript files , where i export and import modules , as shown below .
However ,when opening html page , an error generated in the console shows that :
Access to script at 'file:///C:/Users/index2.js' from origin 'null' has been blocked by CORS policy
Failed to load resource: net::ERR_FAILED (index2.js:1)
I tried to desactivate CORS but that leads always to the same error , i am using Google Chrome browser .
what is abnormal in code and what to do to resolve this problem ?
index2.js :
export default class test {
static method () {
return ('hello world' ) ;
}
index.js :
import test from './index2.js';
console.log (test.method()) ;
in index.html :
<script type = "module" src="./index.js"></script>
I resolved the problem by setting up a local webserver , I Used XAMPP , the link below shows the installation and usage :
https://www.maketecheasier.com/setup-local-web-server-all-platforms/

Parse error in 'test/step_definitions/requester.js': (1:1): expected: #EOF, #Language, #TagLine, #FeatureLine, #Comment, #Empty

I am developing an API automated test case using cucumber and JavaScript and I am getting this error:
Error: Parse error in 'test/step_definitions/requester.js': (1:1): expected: #EOF, #Language, #TagLine, #FeatureLine, #Comment, #Empty, got '//const fetch = require('node-fetch');'
I have a .feature file within 'features' folder.
In addition, I have two .js files within 'step_definitions' folder. Files are 'my_steps' and 'requester.js'.
The Gruntfile.js contains this line to run it:
command: './node_modules/.bin/cucumber-js /features/*.feature -r /Users/alfredo.bazo/XCore-ContentLibrary-Tests/API-Test/test/step_definitions/*.js',
As per error thrown, it seems that requester.js file is considered as a feature file. Why? How can I fix it?
Thanks in advance.

Webpack/Babel/React - "Uncaught SyntaxError: Unexpected token :"

I have a webpack-dev-server running that compiles and serves some Babel/React code. I have gotten as far as to have it serve the compiled client.js over localhost:3001.
But when I try to include the script in my HTML, I get the following error in Chrome's developer console:
routerWarning.js:19 Uncaught SyntaxError: Unexpected token :
That line belongs to react-router and contains the following code:
process.env.NODE_ENV !== 'production' ? _warning2['default'].apply(undefined, [falseToWarn, message].concat(args)) : undefined;
First, I don't see how that line of code would cause a syntax error. And second, I don't understand how it got in, because this looks like a piece of compiled (babelified) code to me. And finally, I don't know how to fix it! :(
Any help would be greatly appreciated.
I was using webpack's DefinePlugin to set process.env.BABEL_ENV like this:
new DefinePlugin({
'process.env': {
BABEL_ENV: JSON.stringify('client')
}
});
This resulted in webpack replacing all instances of process.env in the code with {"BABEL_ENV":"client"}. The SyntaxError was caused in this part, not in the ternary expression.
I fixed it by setting process.env.BABEL_ENV like this:
new DefinePlugin({
'process.env.BABEL_ENV': JSON.stringify('client')
});

Categories