我收到此错误消息,verdaccio刚崩溃,并且服务器重新启动后不再起作用。当我尝试pm2启动verdaccio时,出现以下错误

Error: Cannot find module '/home/ec2-user/verdaccio'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Object.<anonymous> (/usr/lib/node_modules/pm2/lib/ProcessContainerFork.js:53:21)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:427:7)


npm config ls

; cli configs
scope = ""
user-agent = "npm/4.2.0 node/v7.10.0 linux x64"

; userconfig /home/ec2-user/.npmrc
http-proxy = null
https-proxy = null
registry = "https://registry.npmjs.org/"
strict-ssl = false

; globalconfig /usr/etc/npmrc
registry = "https://registry.npmjs.org/"

; node bin location = /usr/bin/node
; cwd = /home/ec2-user/verdaccio
; HOME = /home/ec2-user
; "npm config ls -l" to show all defaults.


pm2显示verdaccio

│ name              │ verdaccio                                      │
│ restarts          │ 255                                            │
│ uptime            │ 0                                              │
│ script path       │ /home/ec2-user/verdaccio                       │
│ script args       │ N/A                                            │
│ error log path    │ /home/ec2-user/.pm2/logs/verdaccio-error-0.log │
│ out log path      │ /home/ec2-user/.pm2/logs/verdaccio-out-0.log   │
│ pid path          │ /home/ec2-user/.pm2/pids/verdaccio-0.pid       │
│ interpreter       │ node                                           │
│ interpreter args  │ N/A                                            │
│ script id         │ 0                                              │
│ exec cwd          │ /home/ec2-user                                 │
│ exec mode         │ fork_mode                                      │
│ node.js version   │ 7.10.0                                         │
│ watch & reload    │ ✘                                              │
│ unstable restarts │ 0                                              │
│ created at        │ N/A

                    `


我的配置文件如下:

storage: ./storage

auth:
  htpasswd:
    file: ./htpasswd


uplinks:
  npmjs:
    url: https://registry.npmjs.org/

packages:
   'av-*':
      allow_access: $all
      allow_publish: $all

   '*':
      allow_access: $all
      allow_publish: $all
      proxy: npmjs

   '@*/*':
      allow_access: $all
      allow_publish: $authenticated
      proxy: npmjs


https:
  key: /home/ec2-user/verdaccio/verdaccio-keynew.pem
  cert: /home/ec2-user/verdaccio/verdaccio-certnew.pem
  ca: /home/ec2-user/verdaccio/server.ca


logs:
  - {type: stdout, format: pretty, level: http}
  #- {type: file, path: verdaccio.log, level: info}

listen:
- https://devnpm2:4873

max_body_size: 300mb

最佳答案

我想这个问题已经在这里https://github.com/verdaccio/verdaccio/issues/204回答了:)

关于node.js - verdaccio无法开始出现错误“找不到模块”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44273846/

10-15 08:57