yup-phone
yup-phone copied to clipboard
TypeError: (0 , _yup.string)(...).phone is not a function
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
I'm having the same issue.
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
.
Same error here, tried moving it back to 1.2.12 and yup back to ^0.27.0 but didn't work
@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
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]
Thanks for reporting.
Can any one file a PR for the fix? Thanks
this repo doesnt'work
@jamesjara @leonel-os I've updated the project. Kindly, check. It's working in codesandbox.
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
I was also facing this issue