node-wp-i18n icon indicating copy to clipboard operation
node-wp-i18n copied to clipboard

Upgrading from 1.2.7 to 1.2.8 in Node 10 Project causes fatal errors

Open acketon opened this issue 2 months ago • 2 comments
trafficstars

I have an older project that uses grunt and was on node 8. I'm doing incremental upgrades to modernize the build process and when upgrading to node 10 and node-wp-i18n 1.2.8 I encounter the following error:

grunt i18n           
Loading "add-textdomain.js" tasks...ERROR
>> SyntaxError: Unexpected token ;
Loading "makepot.js" tasks...ERROR
>> SyntaxError: Unexpected token ;
Warning: Task "addtextdomain" not found. Use --force to continue.

node-wp-i18n is installed as a dependency of grunt-wp-i18n and is run from a grunt task. It works perfectly fine if I install [email protected] or earlier. But if I let NPM upgrade it to the latest point release of 1.2.8 the taks fails with that error.

I reviewed the changes from 1.2.7 and 1.2.8 and don't see anything obvious that would cause this. Any ideas what the culprit could be? I could lock the dependency to [email protected] but that isn't great for the future.

acketon avatar Aug 21 '25 21:08 acketon

@acketon Those errors seem like they're related to loading the Grunt tasks. Is the only thing that changed updating to the latest version of grunt-wp-i18n (and it's inclusion of [email protected])?

There weren't many changes in the latest releases aside from updating dependencies, so one of those may be causing an issue.

bradyvercher avatar Aug 21 '25 21:08 bradyvercher

@bradyvercher Yes, even if I don't change grunt-wp-i18n to the latest version I still get the same errors.

So it's an older repo and the grunt-wp-i18n was at 1.0.2 and node-wp-i18n was at 1.2.3 in the package-lock.json file. I tried updating the deps and ran into problems. I found that I could upgrade grunt-wp-i18n to 1.0.3 or maybe 1.0.4 (latest) and node-wp-i18n all the way to 1.2.7 without issue. But all else remaining the same as soon as I bump node-wp-i18n to 1.2.8 it results in those errors.

grunt-wp-i18n is managing the dependency of node-wp-i18n of course. But NPM is automatically updating to the latest point release on a clean install. I could lock the repo to only use a max version of node-wp-i18n but that's not ideal. I'm not sure if a newer version of node would help. Unfortunately right now I can't upgrade it beyond node 10 due to other dependency packages used to compile the project that were deprecated and aren't in newer node.

I'm guessing if it isn't an issue with any code change in node-wp-i18n maybe it's one of the deps that were updated? Some jumped quite a bit like glob and mkdirp

acketon avatar Aug 22 '25 13:08 acketon