首页 > 解决方案 > 韦迪亚乔:npm 错误!404 Not Found - GET https://npm.xyz.com/flatted - 没有这样的包可用

问题描述

安装操作系统:

debian Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

我正在使用 Verdaccio 4.3.4

npmproxy@npm:~/verdaccio$ verdaccio
 warn --- config file  - /home/npmproxy/verdaccio/config.yaml
 warn --- Verdaccio started
 warn --- Plugin successfully loaded: verdaccio-htpasswd
 warn --- Plugin successfully loaded: verdaccio-audit
 warn --- http address - http://0.0.0.0:4873/ - verdaccio/4.3.4
 fatal--- cannot create server: listen EADDRINUSE: address already in use 0.0.0.0:4873

我可以在我的私人 npm Verdaccio 上发布、取消发布新库。

verdaccio - 依赖项

现在,我正在尝试将我自己的库部署在一个新项目的 verdaccio 上,但我随时可以得到:

$ npm install @xyz/test-lib
npm ERR! code E404
npm ERR! 404 Not Found - GET https://npm.xyz.com/flatted - no such package available
npm ERR! 404
npm ERR! 404  'flatted@^2.0.1' 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 It was specified as a dependency of '@xyz/test-lib'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

Verdaccio 不想访问https://registry.npmjs.org来检索未在 verdaccio 上发布的库。

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   '@xyz/test-lib'
1 verbose cli ]
2 info using npm@6.14.5
3 info using node@v14.5.0
4 verbose npm-session 2ca27dbe8c627033
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://npm.xyz.com/@xyz%2ftest-lib 107ms (from cache)
8 silly pacote tag manifest for @xyz/test-lib@latest fetched in 124ms
9 timing stage:loadCurrentTree Completed in 155ms
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
13 silly install loadShrinkwrap
14 timing stage:loadIdealTree:loadShrinkwrap Completed in 1ms
15 silly install loadAllDepsIntoIdealTree
16 silly resolveWithNewModule @xyz/test-lib@10.0.0 checking installable status
17 http fetch GET 404 https://npm.xyz.com/flatted 47ms
18 http fetch GET 404 https://npm.xyz.com/jest-coverage-badges 47ms
19 http fetch GET 404 https://npm.xyz.com/uuid 44ms
20 http fetch GET 404 https://npm.xyz.com/moment 48ms
21 http fetch GET 404 https://npm.xyz.com/lodash 51ms
22 http fetch GET 404 https://npm.xyz.com/winston-transport 45ms
23 http fetch GET 404 https://npm.xyz.com/winston-daily-rotate-file 47ms
24 http fetch GET 404 https://npm.xyz.com/winston 54ms
25 http fetch GET 404 https://npm.xyz.com/flatted 14ms
26 http fetch GET 404 https://npm.xyz.com/jest-coverage-badges 14ms
27 http fetch GET 404 https://npm.xyz.com/uuid 12ms
28 silly fetchPackageMetaData error for flatted@^2.0.1 404 Not Found - GET https://npm.xyz.com/flatted - no such package available
29 http fetch GET 404 https://npm.xyz.com/moment 13ms
30 silly fetchPackageMetaData error for jest-coverage-badges@1.1.2 404 Not Found - GET https://npm.xyz.com/jest-coverage-badges - no such package available
31 silly fetchPackageMetaData error for uuid@^3.3.3 404 Not Found - GET https://npm.xyz.com/uuid - no such package available
32 silly fetchPackageMetaData error for moment@^2.24.0 404 Not Found - GET https://npm.xyz.com/moment - no such package available
33 http fetch GET 404 https://npm.xyz.com/lodash 12ms
34 silly fetchPackageMetaData error for lodash@^4.17.15 404 Not Found - GET https://npm.xyz.com/lodash - no such package available
35 http fetch GET 404 https://npm.xyz.com/winston-transport 12ms
36 silly fetchPackageMetaData error for winston-transport@^4.3.0 404 Not Found - GET https://npm.xyz.com/winston-transport - no such package available
37 http fetch GET 404 https://npm.xyz.com/winston-daily-rotate-file 13ms
38 silly fetchPackageMetaData error for winston-daily-rotate-file@^4.2.1 404 Not Found - GET https://npm.xyz.com/winston-daily-rotate-file - no such package available
39 http fetch GET 404 https://npm.xyz.com/winston 12ms
40 silly fetchPackageMetaData error for winston@^3.2.1 404 Not Found - GET https://npm.xyz.com/winston - no such package available
41 http fetch GET 404 https://npm.xyz.com/circular-json 10045ms attempt #2
42 http fetch GET 404 https://npm.xyz.com/circular-json 6ms
43 silly fetchPackageMetaData error for circular-json@^0.5.9 404 Not Found - GET https://npm.xyz.com/circular-json - no such package available
44 timing stage:rollbackFailedOptional Completed in 1ms
45 timing stage:runTopLevelLifecycles Completed in 10219ms
46 silly saveTree test
46 silly saveTree `-- @xyz/test-lib@10.0.0
47 verbose stack Error: 404 Not Found - GET https://npm.xyz.com/flatted - no such package available
47 verbose stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-fetch\check-response.js:104:15
47 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:93:5)
48 verbose statusCode 404
49 verbose pkgid flatted@^2.0.1
50 verbose cwd C:\Git\xyz\test
51 verbose Windows_NT 10.0.18363
52 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "@xyz/test-lib"
53 verbose node v14.5.0
54 verbose npm  v6.14.5
55 error code E404
56 error 404 Not Found - GET https://npm.xyz.com/flatted - no such package available
57 error 404
58 error 404 'flatted@^2.0.1' is not in the npm registry.
59 error 404 You should bug the author to publish it (or use the name yourself!)
60 error 404 It was specified as a dependency of '@xyz/test-lib'
61 error 404 Note that you can also install from a
62 error 404 tarball, folder, http url, or git url.
63 verbose exit [ 1, true ]

config.yaml 是:

#
# This is the default config file. It allows all users to do anything,
# so don't use it on production systems.
#
# Look here for more config file examples:
# https://github.com/verdaccio/verdaccio/tree/master/conf
#

# path to a directory with all packages
storage: ./storage
# path to a directory with plugins to include
plugins: ./plugins

# npm proxy listen
listen:
  - 0.0.0.0:4873

#
http_proxy: http://npm.xyz.com
https_proxy: https://npm.xyz.com

no_proxy: localhost, 127.0.0.1

web:
  enable: true
  title: Verdaccio - npm.xyz.com
  # logo: logo.png
  primary_color: "#4b5e40"
  gravatar: true
  # scope: "@xyz"
  sort_packages: asc

auth:
  htpasswd:
    file: ./htpasswd
    # Maximum amount of users allowed to register, defaults to "+inf".
    # You can set this to -1 to disable registration.
    max_users: -1


security:
  api:
    jwt:
      sign:
        expiresIn: 60d
        notBefore: 1
  web:
    sign:
      expiresIn: 7d


# a list of other known repositories we can talk to
uplinks:
  npmjs:
    #url: https://npm.xyz.com/
    url: https://registry.npmjs.org/

publish:
  allow_offline: true

packages:
  '@*/*':
    # scoped packages
    access: $authenticated
    publish: $authenticated
    unpublish: $authenticated
    proxy: npmjs

  '**':
    # allow all users (including non-authenticated users) to read and
    # publish all packages
    #
    # you can specify usernames/groupnames (depending on your auth plugin)
    # and three keywords: "$all", "$anonymous", "$authenticated"
    access: $authenticated

    # allow all known users to publish/publish packages
    # (anyone can register by default, remember?)
    publish: $authenticated
    unpublish: $authenticated

    # if package is not available locally, proxy requests to 'npmjs' registry
    proxy: npmjs

# You can specify HTTP/1.1 server keep alive timeout in seconds for incoming connections.
# A value of 0 makes the http server behave similarly to Node.js versions prior to 8.0.0, which did not have a keep-alive timeout.
# WORKAROUND: Through given configuration you can workaround following issue https://github.com/verdaccio/verdaccio/issues/301. Set to 0 in case 60 is not enough.
server:
  keepAliveTimeout: 60

middlewares:
  audit:
    enabled: true

# log settings
logs:
  - { type: stdout, format: pretty, level: http }
  #- {type: file, path: verdaccio.log, level: info}
#experiments:
#  # support for npm token command
#  token: false

标签: npmverdaccio

解决方案


您的错误显示:npm ERR!404 Not Found - GET https://npm.xyz.com/flatted - 没有这样的包可用

这似乎表明您有另一个配置行处于活动状态。试着做 :

npm set registry <your registry>
npm login
npm publish

我不得不说文档完全不清楚这应该如何工作。似乎该软件包需要位于上游配置中,并且要添加它,您需要使用较新的版本。

还:

17 http fetch GET 404 https://npm.xyz.com/flatted 47ms

似乎表明它从您的注册表中获取它,然后找不到版本。也许您应该在注册表中将其删除以获取上游版本,或者使用正确的版本。


推荐阅读