Zerion cloned: cloud functions error [Solved]

Hi,

@jeremy (author of the video / code (?) )
Well done! But…

I cloned the sources of the video “I Cloned ZERION in 20 min” via the zip of all projects: https://github.com/MoralisWeb3/demo-apps/archive/refs/heads/main.zip

Btw I got an empty react project via:

npx create-react-app moralis-zerion-clone

So that does not work for me.

After unzipping and in the moralis-zerion-clone map I succeded with:

npm install moralis react-moralis @material-ui/core @material-ui/icons
npm install
npm audit fix

copy .env-example .env

I updated contents of the .env file with my moralis server Application-ID and serverUrl
Motralis Testnet server: https://yjase4iuvprd.moralis.io:2053/server (vs: 0.0.227)
Set to : Ropsten ETH / Amsterdam

And I copied the contents of the src/cloud-functions.js to the Moralis server “cloud functions” screen and save-d it. => error in Moralis server dashboard log:

TypeError: Cannot read property 'define' of undefined
    at eval (eval at customUserPlugin (/moralis-server/cloud/main.js:8:21), <anonymous>:1:32)
    at customUserPlugin (/moralis-server/cloud/main.js:8:21)
    at /moralis-server/lib/cloud-code/plugins/index.js:62:15
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Object.initialize (/moralis-server/lib/cloud-code/plugins/index.js:51:3)
CLOUD FUNCTION ERROR PLEASE CHECK YOUR CLOUD FUNCTION CODE

with the warning sign:
afbeelding

After removing the first line in the “Cloud functions”:

const Moralis = {}; // just to hide IDE errors

this was solved and via “yarn start” the app worked !

I ran “yarn start” and it gave this:

PS C:\Users\marti\Downloads\demo-apps-main\demo-apps-main\moralis-zerion-clone> yarn start
yarn run v1.22.10
warning ..\..\package.json: No license field
$ react-scripts start
'react-scripts' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
PS C:\Users\marti\Downloads\demo-apps-main\demo-apps-main\moralis-zerion-clone> 

What can I do?

EDIT:

I installed yarn and it works.

solution:
Solved.

Here’s how. sorta. so-
PROBLEM - it seems installing babel changed many nodes, yet it did NOT update the yarn.lock and package.json files accordingly.
SOLUTION -
$ yarn info |> made me realize some 2k files are out of date
then ran
$ yarn upgrade |> and it somehow sorted it but didn’t compile yet
then
$ yarn add yarn |> to actually update yarn as it was 1.3.x and required 1.7.x

i think that’s it yet, may have skipped a step or two… better read more about the cli commands i suppose.

1 Like