Open bgold0 opened 5 years ago
I just resolved such a problem in a private repository. Basically the underlying acorn-jsx
was using acorn
6.2.0 and i18next-scanner
was using acron
6.3.0.
When it parsed code, especially the closing slash (e.g. </div>
), it compared two different TokenType.slash
instances because each acorn version created it's own TokenTypes. The result of the comparison was never equal. Code pointer: acorn-jsx/index.jsx, method jsx_parseElementAt(...)
line if (this.eat(tt.slash)) {
was false
all the time.
In my package.json file I'm overwriting the acorn version now manually by doing
"resolutions": {
"acorn": "^6.3.0"
},
I'm now unsure where to fix the versioning problem. Maybe i18next-scanner could add a resolutions
entry to package.json.
I'm using yarn
to install node modules. Maybe that could be relevant as well.
I'm hitting this too. It'd be great if we could get a new release that uses acorn v7?
@tobiasweibel Not sure how that fixed it but but when I added the resolutions
I'm still getting the error.
My current resolutions definition is
"resolutions": {
"**/acorn-jsx/**/acorn": "^6.3.0",
"**/eslint/**/acorn": "^7.0.0",
"acorn": "^6.3.0"
},
But that works only with yarn. This is of course only a workaround and I'm not totally sure how to resolve that issue properly. Most probably moving i18next-scanner to acorn 7 would solve it for now.
Just got the same problem :
i18next-scanner: Unable to parse Trans component from "/home/user/path/to/project/src/index.js"
Error: acorn-private-class-elements does not support mixing different acorn copies
...
This message appears for all files in my project.
@bryan-opslock @jgerigmeyer @yanickrochon
This might work for some people:
Upgrade npm to the latest version.
$ npm i -g npm
Remove node_modules and package-lock.json, then do a fresh install.
$ rm -rf node_modules package-lock.json
$ npm i
Run npm ls
to see the package dependencies. Make sure only acorn@6.3.0
package is installed, and all other ones are deduped, like below:
$ npm ls | grep acorn@6
│ │ ├── acorn@6.3.0 deduped
│ ├── acorn@6.3.0
│ ├── acorn@6.3.0 deduped
Fresh installation of i18next-scanner
and react-i18next
and I run into the same problem. Solutions from this thread didn't help so far.
Any news on this?
Running into the same issue here :(
Same issue
I have the same issue, first I get
i18next-scanner: Unable to parse Trans component from "/home/vagrant/kehu/client/index.js"
Error: acorn-private-class-elements requires acorn@^6.1.0, not 2.7.0
errors for all files. After running npm install --save-dev acorn@6.1.0
the error changes to
Error: acorn-private-class-elements does not support mixing different acorn copies
I have done fresh install and it didn't help. Any suggestions where to start solving the issue?
+1
+1
I fixed my issues by adjusting my options
{
options: {
// ...
trans: {
// ...
acorn: {
ecmaVersion: 2020 // default is 10, so must override
}
}
}
I get a lot of these errors when I run i18n-scanner.
Anyone know how to fix them? this wasn't always the case.
Version
Configuration