Local dev environment deploy error

Hi, got this error when try to deploy api locally:
TypeError: this.context.instance.getResourceName is not a function

my webiny/cli version 3.2.8

Any ideas would be much appreciated.

Hi @hadisonick, this error can occur if there is a package version mismatch. Please upgrade all webiny packages to the latest version. Run yarn upgrade --interactive.

Hi Pavel, thanks for you reply. I ran the yarn upgrade command and it seemed to have got the right packages. However I still got the same error when I tried to deploy api. Can I ask which package might cause the mismatch and I can check the version?

Hi Pavel, still struggled with the same error which stop me continue trying webiny. Any help would be much helpful. thanks

Hey @hadisonick, I’m so sorry I didn’t get back to you. I started testing and was distracted by something with the team and by the time we were done I forgot I even started…

I’m testing the setup from scratch, with current npm packages, and I’ll get back to you.

@hadisonick I successfully deployed the project by installing it from scratch. We’ll have to do some debugging on your side.

Usually this error you encounter was caused by an old @webiny/cli version, but yours is 3.2.8, and so is mine, so it’s the latest version available.

Let’s try a couple of things:

  1. in your project root, run webiny --version, send me the version it prints.
  2. run which webiny and send me the output.

There just HAS to be a conflict.

Another way to try this, is to remove the global installation of @webiny/cli, and install it as a local dependency. If you want to try this, follow these steps:

  1. npm -g uninstall @webiny/cli
  2. mkdir webiny-test && cd webiny-test && yarn init -y && yarn add @webiny/cli
  3. node ./node_modules/.bin/webiny create test-project
  4. inside of the test-project folder, update the .env.json with your Mongo credentials
  5. inside of the test-project, run this: node ../node_modules/.bin/webiny deploy-api --env=local --debug

We’re creating a local sandbox folder, with local @webiny/cli dependency and we’re creating a new Webiny project within that sandbox folder. This is to keep everything local and relative to that particular folder; no global installations.

I know this is insane, but let’s try it to get to the bottom of it :slight_smile:
Let me know how this goes.


Hi Pavel, thanks for the detailed steps. I would be very interested in testing sites by using webiny.
When I tried the first step, the webiny version shows 2.6.0 and the output (git bash) is:

As you suggested there does seem to be a confict which it shows 3.2.8 running command npm -g install @webiny/cli

I also tried npm -g update @webiny/cli and it doesnt seem to update the webiny at all though.

Just wondering how I can fix this conflict between versions?

@hadisonick great, we’re getting somewhere! Looks like you installed @webiny/cli using yarn, so you have it in .../apps/yarn/current/global/node_modules/.bin/webiny, AND you have it installed using npm. So you have 2 copies and I guess yarn gives priority to the one in .../yarn/current folder, thus pulling in the older version.

I suggest you remove both global installations, and just do 1 global installation using npm. Then it should be fine. Once you do it, verify that the steps from my previous post give you the expected results.

Looking forward to your next update. We’ll sort this out :slight_smile:

Hi Pavel, when I removed both installations and did a refresh install, the webiny site is working now! I remember I had installed previous version before. I am now trying the site and webiny looks very cool. Your team has done a great work! Hope to build some live site with webiny and look forward to more nice features from you guys.

1 Like

Hi @hadisonick, so glad you finally managed to run Webiny! :rocket: :tada:

We are shipping our next big release in a couple of weeks and things will get even more exciting, so stay tuned!

Looking forward to seeing you around the community :slight_smile: Feel free to join our Gitter and post issues on Github :rocket: