I'm getting this error when running eslint init, It doesnt appear to be triggered by any of my files, rather by its own code. I've seen someone on another site with the same error message. I've tried to uninstall and reinstall and tried an older version to no avail.
oem@Trevor:~/signal-labs-nodejs-coding-challenege$ eslint --init
? How would you like to use ESLint? To check syntax, find problems, and enforce code style
? What type of modules does your project use? JavaScript modules (import/export)
? Which framework does your project use? None of these
? Does your project use TypeScript? No
? Where does your code run? Browser, Node
? How would you like to define a style for your project? Use a popular style guide
? Which style guide do you want to follow? Airbnb:
? What format do you want your config file to be in? JavaScript
Checking peerDependencies of eslint-config-airbnb-base@latest
Unexpected token { in JSON at position 139
SyntaxError: Unexpected token { in JSON at position 139
at JSON.parse (<anonymous>)
at Object.fetchPeerDependencies (/usr/local/lib/node_modules/eslint/lib/init/npm-utils.js:83:17)
at getPeerDependencies (/usr/local/lib/node_modules/eslint/lib/init/config-initializer.js:81:27)
at hasESLintVersionConflict (/usr/local/lib/node_modules/eslint/lib/init/config-initializer.js:388:30)
at Object.when (/usr/local/lib/node_modules/eslint/lib/init/config-initializer.js:568:83)
at /usr/local/lib/node_modules/eslint/node_modules/run-async/index.js:25:25
at new Promise (<anonymous>)
at /usr/local/lib/node_modules/eslint/node_modules/run-async/index.js:24:19
at /usr/local/lib/node_modules/eslint/node_modules/inquirer/lib/ui/prompt.js:114:32
at Observable._subscribe (/usr/local/lib/node_modules/eslint/node_modules/rxjs/internal/observable/defer.js:10:21)
I'm getting this error when running eslint init, It doesnt appear to be triggered by any of my files, rather by its own code. I've seen someone on another site with the same error message. I've tried to uninstall and reinstall and tried an older version to no avail.
oem@Trevor:~/signal-labs-nodejs-coding-challenege$ eslint --init
? How would you like to use ESLint? To check syntax, find problems, and enforce code style
? What type of modules does your project use? JavaScript modules (import/export)
? Which framework does your project use? None of these
? Does your project use TypeScript? No
? Where does your code run? Browser, Node
? How would you like to define a style for your project? Use a popular style guide
? Which style guide do you want to follow? Airbnb: https://github./airbnb/javascript
? What format do you want your config file to be in? JavaScript
Checking peerDependencies of eslint-config-airbnb-base@latest
Unexpected token { in JSON at position 139
SyntaxError: Unexpected token { in JSON at position 139
at JSON.parse (<anonymous>)
at Object.fetchPeerDependencies (/usr/local/lib/node_modules/eslint/lib/init/npm-utils.js:83:17)
at getPeerDependencies (/usr/local/lib/node_modules/eslint/lib/init/config-initializer.js:81:27)
at hasESLintVersionConflict (/usr/local/lib/node_modules/eslint/lib/init/config-initializer.js:388:30)
at Object.when (/usr/local/lib/node_modules/eslint/lib/init/config-initializer.js:568:83)
at /usr/local/lib/node_modules/eslint/node_modules/run-async/index.js:25:25
at new Promise (<anonymous>)
at /usr/local/lib/node_modules/eslint/node_modules/run-async/index.js:24:19
at /usr/local/lib/node_modules/eslint/node_modules/inquirer/lib/ui/prompt.js:114:32
at Observable._subscribe (/usr/local/lib/node_modules/eslint/node_modules/rxjs/internal/observable/defer.js:10:21)
Share
Improve this question
asked Jan 8, 2020 at 13:08
Trevor O'FarrellTrevor O'Farrell
732 silver badges8 bronze badges
2
-
This github issue may be helpful, have you checked your
package.json
for syntax errors? – segFault Commented Jan 8, 2020 at 13:18 - @segFault I ran it through a syntax checker and its free of error – Trevor O'Farrell Commented Jan 8, 2020 at 18:50
3 Answers
Reset to default 5In my case this was caused by having an ancient version of node in my project. Updating the node version fixed it for me.
The same thing happened to me. The problem was in the .npm folder that did not have the necessary permissions. I ran the mand:
sudo chmod -R 777 /home/<user>/.npm
And everything went back to working normally
There was an issue opened about this, and here's their solution:
sudo npm cache clean --force
The install went smoothly after that.