#javascript #node.js #npm #eslint
#javascript #node.js #npm #eslint
Вопрос:
Я пытаюсь очистить свой код Javascript, а затем перейти на typescript. Я установил node.js npm и eslint на Ubuntu 20.04. Я запустил npm -init и eslint -init.
$ npx eslist util.js
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/eslist - Not found
npm ERR! 404
npm ERR! 404 'eslist@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/jcobban/.npm/_logs/2021-03-14T19_42_22_328Z-debug.log
Install for eslist@latest failed with code 1
$ npm cache verify
Cache verified and compressed (~/.npm/_cacache):
Content verified: 296 (6848713 bytes)
Index entries: 449
Finished in 0.367s
Я не могу найти ни одного отчета о stackoverflow более года с объяснением этой ошибки или как ее обойти.
$ more .eslintrc.js
module.exports = {
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"react"
],
"rules": {
}
};
журнал
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node',
1 verbose cli '/usr/share/npm/bin/npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'eslist@latest',
1 verbose cli '--global',
1 verbose cli '--prefix',
1 verbose cli '/home/jcobban/.npm/_npx/96863',
1 verbose cli '--loglevel',
1 verbose cli 'error',
1 verbose cli '--json' ]
2 info using npm@6.14.4
3 info using node@v10.19.0
4 verbose npm-session b1a2059d3c7803e8
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 404 https://registry.npmjs.org/eslist 635ms
8 http fetch GET 404 https://registry.npmjs.org/eslist 391ms
9 silly fetchPackageMetaData error for eslist@latest 404 Not Found - GET https:/
/registry.npmjs.org/eslist - Not found
10 timing stage:rollbackFailedOptional Completed in 2ms
11 timing stage:runTopLevelLifecycles Completed in 1043ms
12 verbose stack Error: 404 Not Found - GET https://registry.npmjs.org/eslist -
Not found
12 verbose stack at res.buffer.catch.then.body (/usr/share/npm/node_modules/
npm-registry-fetch/check-response.js:104:15)
12 verbose stack at process._tickCallback (internal/process/next_tick.js:68:
7)
13 verbose statusCode 404
14 verbose pkgid eslist@latest
15 verbose cwd /home/jcobban/public_html/jscripts
16 verbose Linux 5.8.0-7642-generic
17 verbose argv "/usr/bin/node" "/usr/share/npm/bin/npm-cli.js" "install" "eslis
t@latest" "--global" "--prefix" "/home/jcobban/.npm/_npx/96863" "--loglevel" "er
ror" "--json"
18 verbose node v10.19.0
19 verbose npm v6.14.4
20 error code E404
21 error 404 Not Found - GET https://registry.npmjs.org/eslist - Not found
22 error 404
23 error 404 'eslist@latest' is not in the npm registry.
24 error 404 You should bug the author to publish it (or use the name yourself!)
25 error 404 Note that you can also install from a
26 error 404 tarball, folder, http url, or git url.
27 verbose exit [ 1, true ]
Я ввел URL—адрес https://registry.npmjs.org/eslist зашел в мой браузер и получил обратно {«ошибка»: «Не найдено»}
Обратите внимание, что я НИКОГДА не использовал node.js или npm или npx до сегодняшнего дня, так что у меня нет абсолютно никакого опыта, которым я мог бы руководствоваться. Я просто использую то, что есть на странице https://eslint.org/docs/user-guide/getting-started . Я просто хочу очистить свой код.
Комментарии:
1. Возможно, предполагается, что сценарий запрашивает registry.npmjs.org/eslint ? Запрос этого пакета действительно работает.
2.
"eslist" !== "eslint"
Ответ №1:
глупая опечатка. У меня должны быть типы eslint, а не eslist