Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: (0 , _yup.string)(...).phone is not a function #416

Open
leonel-os opened this issue Nov 23, 2020 · 10 comments
Open

TypeError: (0 , _yup.string)(...).phone is not a function #416

leonel-os opened this issue Nov 23, 2020 · 10 comments

Comments

@leonel-os
Copy link

Hi,

Today I updated yup-phone to last version. Then one of my validators stops working and I got the following error:

C:\Users\User\Documents\Momento\development\Wallet\apis\transactions\src\validators\createUserValidators.js:42
const phoneSchema = (0, _yup.string)().phone('US', true).required();
                                       ^

TypeError: (0 , _yup.string)(...).phone is not a function
    at Object.<anonymous> (C:\Users\User\Documents\Momento\development\Wallet\apis\transactions\src\validators\/createUserValidators.js:37:37)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Module._compile (C:\Users\User\Documents\Momento\development\Wallet\apis\transactions\node_modules\pirates\lib\index.js:99:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Object.newLoader [as .js] (C:\Users\User\Documents\Momento\development\Wallet\apis\transactions\node_modules\pirates\lib\index.js:104:7)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Users\User\Documents\Momento\development\Wallet\apis\transactions\src\resolvers\users\/CreateUser.js:6:1)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Module._compile (C:\Users\User\Documents\Momento\development\Wallet\apis\transactions\node_modules\pirates\lib\index.js:99:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Object.newLoader [as .js] (C:\Users\User\Documents\Momento\development\Wallet\apis\transactions\node_modules\pirates\lib\index.js:104:7)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
[nodemon] app crashed - waiting for file changes before starting...

I went back to version 1.2.12 and the issue went away.

Hope you can help me. Regards!

Leonel

@nourmalaeb
Copy link

I'm having the same issue.

@paulstraw
Copy link

I was also running into this problem. Downgrading to yup-phone 1.2.12 (or even 1.2.8) didn't solve my issue. I believe the root cause here is the way npm handles caret version rules for pre-1.x packages. My project's package.json specified yup ^0.31.0 (the latest as of this writing), but yup-phone specifies ^0.30.0, so a compatible version couldn't be found. I resolved this by switching my package.json to yup ^0.30.0.

@diego06884
Copy link

Same error here,
tried moving it back to 1.2.12 and yup back to ^0.27.0 but didn't work

@paulstraw
Copy link

@diego06884 as noted in my previous comment, you need to use the same yup minor version as the minor version specified in yup-phone. In your example of yup-phone 1.2.12, that would mean yup 0.29.1

@trilibi
Copy link

trilibi commented Dec 18, 2020

We were able to resolve this by uninstalling yup and yup-phone.

then installing [email protected] first

npm remove yup
npm remove yup-phone
npm install [email protected]

@abhisekp
Copy link
Owner

abhisekp commented Jan 3, 2021

Thanks for reporting.

Can any one file a PR for the fix?
Thanks

@jamesjara
Copy link

this repo doesnt'work

@abhisekp
Copy link
Owner

@jamesjara @leonel-os I've updated the project. Kindly, check. It's working in codesandbox.

@Rahul-sinha84
Copy link

I was also facing this issue, but resolved this by having the version of yup and yup-phone to be exactly the same as in the codesandbox

@VsevolodKurochka
Copy link

I was also facing this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants