Failed to compile react webapp after using javascript prisma for mysql - mysql

Hello beautiful humans!
I'm working on building a project that uses React Webapp for the frontend, using Prisma to go from javascript to MySql with Aiven to then Twitter API to create auto posts.
GitHub: https://github.com/jennjunod/twitter-tagging
Using this guide from Prisma... Using Miro as a visual representation
Failed to compile.
Error in ./src/reportWebVitals.js
Syntax error: 'import' and 'export' may only appear at the top level (3:0)
1 | const reportWebVitals = onPerfEntry => {
2 | if (onPerfEntry && onPerfEntry instanceof Function) {
> 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
| ^
4 | getCLS(onPerfEntry);
5 | getFID(onPerfEntry);
6 | getFCP(onPerfEntry);
# ./src/index.js 19:23-54

Related

How solve issue TypeError: strings.slice(...).reduce is not a function?

I recently dicovered Gatsby and I want to use this template for my own website:
https://github.com/toboko/gatsby-starter-fine
When downloading it, manage to run it http://localhost:8000/ but I get this error which I can escape:
TypeError: strings.slice(...).reduce is not a function
I added my repository here so you can take a look too: https://github.com/melariza/gatsby-starter-fine
Could you take a look and help fix it?
Screenshot of the error:
enter image description here
Here's the error text:
TypeError: strings.slice(...).reduce is not a function
css
/Users/mga/Sites/gatsby-starter-fine/.cache/loading-indicator/style.js:5
2 |
3 | function css(strings, ...keys) {
4 | const lastIndex = strings.length - 1
> 5 | return (
6 | strings.slice(0, lastIndex).reduce((p, s, i) => p + s + keys[i], ``) +
7 | strings[lastIndex]
8 | )
View compiled
Style
/Users/mga/Sites/gatsby-starter-fine/.cache/loading-indicator/style.js:14
11 | const Style = () => (
12 | <style
13 | dangerouslySetInnerHTML={{
> 14 | __html: css`
15 | :host {
16 | --purple-60: #663399;
17 | --gatsby: var(--purple-60);
View compiled
▶ 18 stack frames were collapsed.
(anonymous function)
/Users/mga/Sites/gatsby-starter-fine/.cache/app.js:165
162 | dismissLoadingIndicator()
163 | }
164 |
> 165 | renderer(<Root />, rootElement, () => {
166 | apiRunner(`onInitialClientRender`)
167 |
168 | // Render query on demand overlay
View compiled
I guess the problem is related to Node and its dependencies. The repository is not an official Gatsby starter and the last commit dates from 3 years ago. Gatsby is now on version 4.14 while the starter is on ^2.0.50. Two major versions happened during the last 3 years only in Gatsby so imagine the rest of the dependencies.
The starter doesn't contain a .nvmrc file or engine property in the package.json so the Node version that runs that project is unknown. Be aware that if you clone or fork that project, you will have a lot of deprecated dependencies and you'll have several migrations to do (from v2 to v3 and from v3 to v4).
So my advice is to reject that repository and use one of the officials. If that's not an option, try playing around with the version of Node, starting from 12 onwards, reinstalling the node_modules each time you upgrade or downgrade the version.

Dependency Parsing in Spacy

I want to extract the pair verb-noun of my text using dependency parsing.
I did this:
document = nlp('appoint department heads or managers and assign or delegate responsibilities to them ')
print ("{:<15} | {:<8} | {:<15} | {:<20}".format('Token','Relation','Head', 'Children'))
print ("-" * 70)
for token in document:
print ("{:<15} | {:<8} | {:<15} | {:<20}"
.format(str(token.text), str(token.dep_), str(token.head.text), str([child for child in token.children])))
from spacy import displacy
displacy.render(document, style = 'dep', jupyter=True )
Can you guys help me do a cleaner one?

openApiGenerate don`t generate Models

I use gradle plugin
id "org.openapi.generator" version "5.1.1"
and task in gradle.plugin
openApiGenerate {
generatorName = "kotlin"
inputSpec = "$rootDir/src/main/resources/META-INF/resources/API.v1.yaml".toString()
outputDir = "$rootDir/generated".toString()
apiPackage = "org.openapi.example.api"
invokerPackage = "org.openapi.example.invoker"
modelPackage = "org.openapi.example.model"
configOptions = [
dateLibrary: "java8"
]
}
when I call gradlew openApiGenerate
I got
Execution failed for task ':openApiGenerate'.
> There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI).
| Error count: 244, Warning count: 0
Errors:
-attribute paths.'/v1/pet/{name}/home/'(post).responses.406.content is unexpected
-attribute paths.'/v1/pet/{name}/home'(post).responses.400.content is unexpected
..........
But if I call in CLI version my yaml generate Models and API
Why it call that Exceptions?
Unfortunatelly, I can not add here even a part of my yaml, because site told me "ït looks you add a lot of code"
If I add
skipValidateSpec = true
I get only API without Models. Why?

Karate does not display a response after a POST request with status 201 [duplicate]

This question already has an answer here:
Support passing from Scenario Outline to JSON file
(1 answer)
Closed 2 years ago.
I am struggling with the following test, which is usually pretty easy...
Feature: Testing Env Create Feature
Scenario Outline: Create works as intended
Given url "http://localhost:10000/api/envs"
And request {"name": <Name>,"gcpProjectName": <GcpProjectName>,"url": <Url>}
When method POST
Then status 201
And match response contains {"id": #string, "name": <Name>,"gcpProjectName": <GcpProjectName>,"url": <Url>}
Examples:
| Name | GcpProjectName | Url |
| tests | D-COO-ContinuousCollaboration | https://fake.com |
| approval | Q-COO-ContinuousCollaboration | https://fake.com |
| demo | P-COO-ContinuousCollaboration | https://fake.com |
| prod | P-COO-ContinuousCollaboration | https://fake.com |
I am supposed to get a response summarizing my POST request that I successfully get using curl, Postman or even Swagger, but it does not appear with Karate:
[failed features:
src.test.features.envtest.env-create: [1.1:13] env-create.feature:9 - path: $, actual: '', expected: '{"id":"#string","name":"tests","gcpProjectName":"D-COO-ContinuousCollaboration","url":"https://fake.com"}', reason: not a sub-string
Anyone knows what happens ?
Thanks for your help.
Just add quotes around string substitutions:
And request {"name": "<Name>", "gcpProjectName": "<GcpProjectName>", "url": "<Url>" }

thread "main" java.lang.ClassNotFoundException

Trying to run a job, but i keep getting this error. I do not know how to resolve it. Is there something im missing? What is wrong here?
This is in my shell
[cloudera#localhost home]$ hadoop jar cloudera/MinMaxCountDriver.jar MinMaxCount /user/cloudera/Comments.xml /user/cloudera/SuperUserXML/
This is the error i am getting
Exception in thread "main" java.lang.ClassNotFoundException: MinMaxCount
....
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.apache.hadoop.util.RunJar.main(RunJar.java:201)
Here is my driver.
public class MinMaxCountDriver {
public static void main(String []args) throws Exception
{
Configuration conf = new Configuration();
String [] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
if(otherArgs.length !=2 )
{
System.err.println("You need 2 Arguement");
System.exit(2);
}
...
FileInputFormat.addInputPath(job, new Path(otherArgs[0]));
FileOutputFormat.setOutputPath(job, new Path(otherArgs[1]));
System.exit(job.waitForCompletion(true)? 0: 1);
}
}
Basic command to run MR jobs is
hadoop jar myjar.jar classname inputfolder outputfolder
For me it works without classname also
myproject
|
|
-----> mypackage
|
|
---->Driver.java
|
|
---->Mapper.java
|
|
---->Reducer.java
If this is the tree I need not want to specify the classname
hadoop jar driver.jar in out
But
myproject
|
|
-----> mypackage
| |
| |
| ---->Driver.java
| |
| |
| ---->Mapper.java
| |
| |
| ---->Reducer.java
|
----> mypackage2
|
|
---->Driver2.java
|
|
---->Mapper2.java
|
|
---->Reducer2.java
For this I need to specify my classname which driver class I am trying to execute.
hadoop jar driver2.jar mypackage2.Driver2 in out
Each class in the .jar has [package MapRedDesign;] at the top.
Based on your comments, make sure you fully qualify your class name with the package, otherwise Java will have no idea where to find it.
hadoop jar cloudera/MinMaxCountDriver.jar MapRedDesign.MinMaxCount /user/cloudera/Comments.xml /user/cloudera/SuperUserXML/