【发布时间】:2021-06-12 04:34:21
【问题描述】:
我正在尝试清理我的 Javascript 代码,然后迁移到 typescript。我在 Ubuntu 20.04 上安装了 node.js npm 和 eslint。我运行了 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 并返回 {"error":"Not found"}
请注意,在今天之前我从未使用过 node.js 或 npm 或 npx,所以我完全没有经验来指导我。我只是按照页面https://eslint.org/docs/user-guide/getting-started 中的内容进行操作。我只是想清理我的代码。
【问题讨论】:
-
脚本是否应该请求registry.npmjs.org/eslint?请求该软件包确实有效。
-
"eslist" !== "eslint"
标签: javascript node.js npm eslint