SyntaxError: Unknown token: { line: 4, col: 2, type: 'INVALID', value: undefined } 4:2 in lockfile

See original GitHub issue

I’ve deleted the yarn.lock and tried this using bash and cmd with no success. Does this tool only support specific versions of yarn (and the associated lock file)?

D:\WORK\frontend>yarn-audit-fix
Runtime digest

  isMonorepo false
  npmPath D\\WORK\\frontend\\node_modules\\yarn-audit-fix\\node_modules\\.bin\\npm.cmd
  npmVersion 8.1.2
  nodeVersion v14.18.1
  yafVersion 7.1.5
  temp D\\WORK\\frontend\\node_modules\\.cache\\yarn-audit-fix\\04610f6eea2bfb3e8bb3333ee22ac42b
  cwd D\\WORK\\frontend
  flags
    flow patch
    npm-path local


Preparing temp assets...
Patching yarn.lock with audit data...
Failure!
SyntaxError: Unknown token: { line: 4, col: 2, type: 'INVALID', value: undefined } 4:2 in lockfile
    at Parser.unexpected (D:\WORK\frontend\node_modules\@yarnpkg\lockfile\index.js:5064:11)
    at Parser.parse (D:\WORK\frontend\node_modules\@yarnpkg\lockfile\index.js:5193:14)
    at parse (D:\WORK\frontend\node_modules\@yarnpkg\lockfile\index.js:5262:17)
    at Object.module.exports.exports.default (D:\WORK\frontend\node_modules\@yarnpkg\lockfile\index.js:4835:96)
    at Object._read (file:///D:/WORK/frontend/node_modules/yarn-audit-fix/target/es6/lockfile.js:7:21)
    at Module.read (file:///D:/WORK/frontend/node_modules/yarn-audit-fix/target/es6/lockfile.js:89:44)
    at patchLockfile (file:///D:/WORK/frontend/node_modules/yarn-audit-fix/target/es6/stages.js:144:25)
    at exec (file:///D:/WORK/frontend/node_modules/yarn-audit-fix/target/es6/runner.js:30:13)
    at Function.runSync [as sync] (file:///D:/WORK/frontend/node_modules/yarn-audit-fix/target/es6/runner.js:41:9)
    at file:///D:/WORK/frontend/node_modules/yarn-audit-fix/target/es6/cli.js:33:5
internal/process/esm_loader.js:74
    internalBinding('errors').triggerUncaughtException(
                              ^

SyntaxError: Unknown token: { line: 4, col: 2, type: 'INVALID', value: undefined } 4:2 in lockfile
    at Parser.unexpected (D:\WORK\frontend\node_modules\@yarnpkg\lockfile\index.js:5064:11)
    at Parser.parse (D:\WORK\frontend\node_modules\@yarnpkg\lockfile\index.js:5193:14)
    at parse (D:\WORK\frontend\node_modules\@yarnpkg\lockfile\index.js:5262:17)
    at Object.module.exports.exports.default (D:\WORK\frontend\node_modules\@yarnpkg\lockfile\index.js:4835:96)
    at Object._read (file:///D:/WORK/frontend/node_modules/yarn-audit-fix/target/es6/lockfile.js:7:21)
    at Module.read (file:///D:/WORK/frontend/node_modules/yarn-audit-fix/target/es6/lockfile.js:89:44)
    at patchLockfile (file:///D:/WORK/frontend/node_modules/yarn-audit-fix/target/es6/stages.js:144:25)
    at exec (file:///D:/WORK/frontend/node_modules/yarn-audit-fix/target/es6/runner.js:30:13)
    at Function.runSync [as sync] (file:///D:/WORK/frontend/node_modules/yarn-audit-fix/target/es6/runner.js:41:9)
    at file:///D:/WORK/frontend/node_modules/yarn-audit-fix/target/es6/cli.js:33:5

D:\WORK\frontend>

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
antongolubcommented, Dec 13, 2021

Sure, sorry.

0reactions
stee-rencommented, Dec 13, 2021

That worked perfectly Anton, thank you for your super quick turn around on this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unknown token: { line: 1, col: 0, type: 'INVALID', value - GitHub
I get this error whenever I do something with yarn. C:\Users\chawki\Documents\Project\npm\medium-fetch>yarn publish yarn publish v1.13.0 ...
Read more >
Problem with yarn.lock at build time - Netlify Support Forums
6:29:13 PM: error An unexpected error occurred: “Unknown token: { line: 3, col: 2, type: 'INVALID', value: undefined } 3:2 in ...
Read more >
Hey unfortunettlly this doesn't work Unknown token: { line: 3, col
It seems to be related to yarn.lock file. Try to add this file to dockerignore file and see if it's still happen:).
Read more >
How to solve unexpected token issue in yarn installation
The error is caused by the old version of nodejs (usually lower than v6). First install the latest stable version of nodejs or...
Read more >
List of All Codes - Novell Error Codes Reference Guide
1.4.2 Sorted by Decimal Number - Negative to Positive · -001 FFFFFFFF INSUFFICIENT SPACE · -1 FFFFFFFF OPERATION FAILURE · -1 SAS E...
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