question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

lingui-cli extract

See original GitHub issue

Hi, I have upgraded the package since last time, here is my config:

├─┬ babel-preset-lingui-react@1.0.1
│ ├── babel-plugin-lingui-transform-js@1.0.1
│ └── babel-plugin-lingui-transform-react@1.0.1
├─┬ lingui-cli@1.0.4
│ ├── babel-plugin-lingui-extract-messages@1.0.2
├─┬ lingui-conf@0.8.1
├─┬ lingui-i18n@1.0.1
│ └── lingui-formats@1.0.1
├── lingui-react@1.0.1

But I encounter a problem when I do lingui extract, Unexpected token. The code is fine and works when I yarn build it or yarn start it

yarn lingui v0.27.5
$ "/home/lfdmr/Dev/test/web_frontend/node_modules/.bin/lingui" "extract"

/home/lfdmr/Dev/test/web_frontend/node_modules/lingui-cli/node_modules/babel-core/lib/transformation/file/index.js:590
      throw err;
      ^

SyntaxError: /home/lfdmr/Dev/test/web_frontend/src/App1/components/App.js: Unexpected token (6:2)
  4 | 
  5 | const App = () => (
> 6 |   <h1><Trans>Welcome App 1!</Trans></h1>
    |   ^
  7 | )
  8 | 
  9 | export default App
    at Parser.pp$5.raise (/home/lfdmr/Dev/test/web_frontend/node_modules/lingui-cli/node_modules/babylon/lib/index.js:4454:13)
    at Parser.pp.unexpected (/home/lfdmr/Dev/test/web_frontend/node_modules/lingui-cli/node_modules/babylon/lib/index.js:1761:8)
    at Parser.pp$3.parseExprAtom (/home/lfdmr/Dev/test/web_frontend/node_modules/lingui-cli/node_modules/babylon/lib/index.js:3750:12)
    at Parser.pp$3.parseExprSubscripts (/home/lfdmr/Dev/test/web_frontend/node_modules/lingui-cli/node_modules/babylon/lib/index.js:3494:19)
    at Parser.pp$3.parseMaybeUnary (/home/lfdmr/Dev/test/web_frontend/node_modules/lingui-cli/node_modules/babylon/lib/index.js:3474:19)
    at Parser.pp$3.parseExprOps (/home/lfdmr/Dev/test/web_frontend/node_modules/lingui-cli/node_modules/babylon/lib/index.js:3404:19)
    at Parser.pp$3.parseMaybeConditional (/home/lfdmr/Dev/test/web_frontend/node_modules/lingui-cli/node_modules/babylon/lib/index.js:3381:19)
    at Parser.pp$3.parseMaybeAssign (/home/lfdmr/Dev/test/web_frontend/node_modules/lingui-cli/node_modules/babylon/lib/index.js:3344:19)
    at Parser.pp$3.parseParenAndDistinguishExpression (/home/lfdmr/Dev/test/web_frontend/node_modules/lingui-cli/node_modules/babylon/lib/index.js:3828:26)
    at Parser.pp$3.parseExprAtom (/home/lfdmr/Dev/test/web_frontend/node_modules/lingui-cli/node_modules/babylon/lib/index.js:3709:19)
error Command failed with exit code 1.

Thanks

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
iamnimnulcommented, Jan 15, 2019

I had same error but caused by the different issue. react-scripts were missing in dependencies. https://github.com/lingui/js-lingui/issues/434

{
  // ...
  "dependencies": {
    "@lingui/react": "^2.7.2",
    "react": "^16.6.1",
    "react-dom": "^16.6.1",
    "react-router-dom": "^4.3.1",
+   "react-scripts": "^2.1.3",
    // ...
  }
  // ...
}
0reactions
tricoder42commented, Jul 11, 2017

Added section about integrations to docs https://lingui.gitbooks.io/js/guides/integrations.html

Read more comments on GitHub >

github_iconTop Results From Across the Web

API Reference - CLI (@lingui/cli) — LinguiJS documentation
@lingui/cli manages locales, extracts messages from source files into message catalogs and compiles message catalogs for production use.
Read more >
CLI/Watch - Extract with [files] marks other strings as obsolete ...
CLI - Whenever I pass a [files] string into the cmd it is not recognized and command is extracting from all source path...
Read more >
@lingui/cli - npm
CLI for working wit message catalogs. Latest version: 3.15.0, last published: a month ago. Start using @lingui/cli in your project by ...
Read more >
@lingui/cli NPM | npm.io
You can run the scripts directly using a tool for executing Node packages NPX . NPX is included in NPM version 5.2 and...
Read more >
@lingui/conf | Yarn - Package Manager
Features · accept t as function (c0c08ba) · add cli option to extract only a specific locale (#816 (49f45b2) · enable pseudolocalization from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found