-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Error Building utils.js with libphonenumber v20.3.0: 'grunt' Command Not Recognized #1696
Comments
Are you following the instructions here? Can you list the steps you have already run (have you done the
Not currently, though you could simply hide it with CSS. Can I ask why you would want to do this though? |
I'm very sorry, I completely forgot to run the npm install step in the root intl-tel-input directory. Thank you for pointing that out. Regarding the additional country search feature, I understand there's currently no built-in option to disable it, and it can be hidden with CSS. We were looking for a manual option to disable it because we are updating from an older jQuery version to the new one, and this is one of the design changes we are facing. Additionally, I noticed two new files, intlTelInputWithUtils.js and intlTelInputWithUtils.min.js. Upon looking into utils.js, I found: const utils = window.intlTelInputUtilsTemp; This causes an error whenever I use intlTelInputUtils.formatNumber. Could you guide me on how to use it with the newer version? Older version used: 17.0.19 |
These didn't exist in v20.3.0 - are you still using that version? If you stick with that version, and make sure you use that version of utils.js as well, then |
We are currently using version 17.0.19 of your plugin. We are now updating to the latest version. I understand that the latest version has removed jQuery support and introduced intlTelInputWithUtils.js and intlTelInputWithUtils.min.js. Despite loading utils.js as part of the intlTelInput bundle, attempting to use intlTelInput.utils.formatNumber() results in an error: 'Cannot read properties of undefined (reading 'formatNumber')'. In the older version, I loaded utils.js in the following order, and referenced functions like intlTelInputUtils.formatNumber() successfully:
For the newer version, I learned that we should use intlTelInput.utils.formatNumber() after it is loaded. Even though I can see the file loaded in the sources under page content, attempting to use it still results in the error 'Cannot read properties of undefined (reading 'formatNumber')'. As a workaround, I have manually loaded the script using loadUtils, and in the callback, I used the regular function. Could you please guide me on how this can be done without manually loading the scripts? |
I'm afraid I cannot reproduce this issue. I've put together this codepen which loads intlTelInputWithUtils.js (from v23.3.2) onto the page, and then accesses |
I noticed in your CodePen sample that you have only loaded the Currently, I have loaded it as shown below.
My concern is that both intlTelInput and methods from utils are combined into one. What should I do if I want to update the utils in the intlTelInputWithUtils file? I understand that for a separate utils.js file, you can follow the instructions mentioned here: Updating to a new version of libphonenumber. |
If you follow the instructions to update utils.js locally, then you can re-build the intlTelInputWithUtils.js file by running |
Plugin version
v20.3.0
Steps to reproduce
'grunt' is not recognized as an internal or external command, operable program or batch file.
Expected behaviour
The utils.js file should be built successfully using the
grunt
command.Actual behaviour
The build process fails with the error message
'grunt' is not recognized as an internal or external command, operable program or batch file.
Additional context
We have utilized the jQuery version of the plugin and are encountering issues where some valid phone numbers are being marked as invalid. To resolve this, we decided to update only the libphonenumber library without updating the entire plugin, selecting version 20.3.0. However, when trying to build the utils.js file, we encounter the above-mentioned error.
Also, is there any option to disable the additional country search feature added to latest version?
Thanks in advance.
The text was updated successfully, but these errors were encountered: