因此,我最近为Puppeteer添加了一个方法,并遇到了一些奇怪的问题。我正在使用GC函数。现在,每当我启动我的服务器时,都会得到这样的结果:
[1] > functions@ shell /Users/ayoung/repurpose/functions
[1] > firebase functions:shell
[1]
[0] ℹ 「wds」: Project is running at http://192.168.0.191/
[0] ℹ 「wds」: webpack output is served from
[0] ℹ 「wds」: Content not from webpack is served from /Users/ayoung/repurpose/client/public
[0] ℹ 「wds」: 404s will fallback to /
[0] Starting the development server...
[0]
[1] ✔ functions: functions emulator started at http://localhost:5000
[1] i functions: Loaded functions: app
[1] firebase > > events.js:183
[1] > throw er; // Unhandled 'error' event
[1] > ^
[1] >
[1] > Error: listen EADDRINUSE :::4242
[1] > at Server.setupListenHandle [as _listen2] (net.js:1360:14)
[1] > at listenInCluster (net.js:1401:12)
[1] > at Server.listen (net.js:1485:7)
[1] > at Function.listen (/Users/ayoung/repurpose/functions/node_modules/express/lib/application.js:618:24)
[1] > at Object.<anonymous> (/Users/ayoung/repurpose/functions/index.js:229:5)
[1] > at Module._compile (module.js:653:30)
[1] > at Object.Module._extensions..js (module.js:664:10)
[1] > at Module.load (module.js:566:32)
[1] > at tryModuleLoad (module.js:506:12)
[1] > at Function.Module._load (module.js:498:3)因此,我的服务器在本地主机上运行:4242,因此是我的index.js (服务器)文件的结尾:
app.listen(4242, () => console.log(`Node server listening on port ${4242}!`));
exports.app = functions.https.onRequest(app);所以这里是奇怪的部分:
1)由于这个问题,我没有添加任何依赖项,也没有安装任何东西。我刚刚添加了一个Puppeteer方法,我已经在使用它了。
2)我的客户端index.js (服务器)文件根本没有被引用。我注释掉了整个文件,并且我仍然能够执行服务器端调用。这段代码到底存储在哪里?它引用的是什么?我该如何解决这个问题?谢谢。
[debug] [2020-05-23T01:57:18.894Z] ----------------------------------------------------------------------
[debug] [2020-05-23T01:57:18.896Z] Command: /Users/ayoung/.nvm/versions/node/v8.17.0/bin/node /Users/ayoung/.nvm/versions/node/v8.17.0/bin/firebase functions:shell
[debug] [2020-05-23T01:57:18.896Z] CLI Version: 8.0.1
[debug] [2020-05-23T01:57:18.896Z] Platform: darwin
[debug] [2020-05-23T01:57:18.896Z] Node Version: v8.17.0
[debug] [2020-05-23T01:57:18.897Z] Time: Fri May 22 2020 20:57:18 GMT-0500 (CDT)
[debug] [2020-05-23T01:57:18.897Z] ----------------------------------------------------------------------
[debug] [2020-05-23T01:57:18.897Z]
[debug] [2020-05-23T01:57:18.906Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2020-05-23T01:57:18.906Z] > authorizing via signed-in user
[debug] [2020-05-23T01:57:18.906Z] [iam] checking project my_project for permissions ["firebase.projects.get"]
[debug] [2020-05-23T01:57:18.909Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/my_project:testIamPermissions
{"permissions":["firebase.projects.get"]}
[debug] [2020-05-23T01:57:19.178Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 23 May 2020 01:57:19 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","server-timing":"gfet4t7; dur=94","alt-svc":"h3-27=\":443\"; ma=2592000,h3-25=\":443\"; ma=2592000,h3-T050=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
[debug] [2020-05-23T01:57:19.187Z] [functions] Using node@8 from host.
[info] ✔ functions: functions emulator started at http://localhost:5000
[debug] [2020-05-23T01:57:19.196Z] [functions] Watching "/Users/ayoung/repurpose/functions" for Cloud Functions...
[debug] [2020-05-23T01:57:19.205Z] DEBUG: [worker-pool] addWorker(~diagnostic~)
[debug] [2020-05-23T01:57:19.205Z] DEBUG: [worker-pool] Adding worker with key ~diagnostic~, total=1
[debug] [2020-05-23T01:57:19.205Z] DEBUG: [worker-pool] submitWork(triggerId=)
[debug] [2020-05-23T01:57:19.206Z] DEBUG: [worker-~diagnostic~-b3e0b9cb-24b5-4dcd-b68b-55350c0ee44c]: Assigning socketPath: /var/folders/hz/k8tg3wrx5ml92_bp_153hpkm0000gq/T/fire_emu_11478.sock
[debug] [2020-05-23T01:57:19.206Z] DEBUG: [worker-~diagnostic~-b3e0b9cb-24b5-4dcd-b68b-55350c0ee44c]: BUSY
[debug] [2020-05-23T01:57:19.480Z] DEBUG: [runtime-status] [11478] Functions runtime initialized. {"cwd":"/Users/ayoung/repurpose/functions","node_version":"8.17.0"}
[debug] [2020-05-23T01:57:19.480Z] DEBUG: [runtime-status] [11478] Disabled runtime features: undefined
[debug] [2020-05-23T01:57:19.482Z] DEBUG: [runtime-status] [11478] Resolved module firebase-admin {"declared":true,"installed":true,"version":"8.10.0","resolution":"/Users/ayoung/repurpose/functions/node_modules/firebase-admin/lib/index.js"}
[debug] [2020-05-23T01:57:19.482Z] DEBUG: [runtime-status] [11478] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.5.0","resolution":"/Users/ayoung/repurpose/functions/node_modules/firebase-functions/lib/index.js"}
[debug] [2020-05-23T01:57:19.486Z] DEBUG: [runtime-status] [11478] Outgoing network have been stubbed. [{"name":"http","status":"mocked"},{"name":"http","status":"mocked"},{"name":"https","status":"mocked"},{"name":"https","status":"mocked"},{"name":"net","status":"mocked"}]
[debug] [2020-05-23T01:57:19.529Z] DEBUG: [runtime-status] [11478] Checked functions.config() {"config":{}}
[debug] [2020-05-23T01:57:19.530Z] DEBUG: [runtime-status] [11478] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.5.0","resolution":"/Users/ayoung/repurpose/functions/node_modules/firebase-functions/lib/index.js"}
[debug] [2020-05-23T01:57:19.531Z] DEBUG: [runtime-status] [11478] Resolved module firebase-admin {"declared":true,"installed":true,"version":"8.10.0","resolution":"/Users/ayoung/repurpose/functions/node_modules/firebase-admin/lib/index.js"}
[debug] [2020-05-23T01:57:19.531Z] DEBUG: [runtime-status] [11478] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.5.0","resolution":"/Users/ayoung/repurpose/functions/node_modules/firebase-functions/lib/index.js"}
[debug] [2020-05-23T01:57:19.532Z] DEBUG: [runtime-status] [11478] firebase-admin has been stubbed. {"adminResolution":{"declared":true,"installed":true,"version":"8.10.0","resolution":"/Users/ayoung/repurpose/functions/node_modules/firebase-admin/lib/index.js"}}
[debug] [2020-05-23T01:57:19.992Z] DEBUG: [runtime-status] [11478] initializeApp(DEFAULT) {"databaseURL":"https://my_project.firebaseio.com","storageBucket":"my_project.appspot.com","projectId":"my_project","credential":{"implicit":false,"projectId":"my_project",\n","clientEmail":"firebase-adminsdk-bn2gp@my_project.iam.gserviceaccount.com","httpClient":{"retry":{"maxRetries":4,"statusCodes":[503],"ioErrorCodes":["ECONNRESET","ETIMEDOUT"],"backOffFactor":0.5,"maxDelayInMillis":60000}}}}
[debug] [2020-05-23T01:57:19.999Z] [functions[app]] http function initialized (http://localhost:5000/my_project/us-central1/app).
[info] i functions: Loaded functions: app
[debug] [2020-05-23T01:57:20.003Z] DEBUG: [worker-~diagnostic~-b3e0b9cb-24b5-4dcd-b68b-55350c0ee44c]: IDLE
[info] > events.js:183 {"user":"events.js:183"}
[info] > throw er; // Unhandled 'error' event {"user":" throw er; // Unhandled 'error' event"}
[info] > ^ {"user":" ^"}
[info] > {"user":""}
[info] > Error: listen EADDRINUSE :::4242 {"user":"Error: listen EADDRINUSE :::4242"}
[info] > at Server.setupListenHandle [as _listen2] (net.js:1360:14) {"user":" at Server.setupListenHandle [as _listen2] (net.js:1360:14)"}
[info] > at listenInCluster (net.js:1401:12) {"user":" at listenInCluster (net.js:1401:12)"}
[info] > at Server.listen (net.js:1485:7) {"user":" at Server.listen (net.js:1485:7)"}
[info] > at Function.listen (/Users/ayoung/repurpose/functions/node_modules/express/lib/application.js:618:24) {"user":" at Function.listen (/Users/ayoung/repurpose/functions/node_modules/express/lib/application.js:618:24)"}
[info] > at Object.<anonymous> (/Users/ayoung/repurpose/functions/index.js:229:5) {"user":" at Object.<anonymous> (/Users/ayoung/repurpose/functions/index.js:229:5)"}
[info] > at Module._compile (module.js:653:30) {"user":" at Module._compile (module.js:653:30)"}
[info] > at Object.Module._extensions..js (module.js:664:10) {"user":" at Object.Module._extensions..js (module.js:664:10)"}
[info] > at Module.load (module.js:566:32) {"user":" at Module.load (module.js:566:32)"}
[info] > at tryModuleLoad (module.js:506:12) {"user":" at tryModuleLoad (module.js:506:12)"}
[info] > at Function.Module._load (module.js:498:3) {"user":" at Function.Module._load (module.js:498:3)"}
[debug] [2020-05-23T01:57:20.009Z] DEBUG: [worker-~diagnostic~-b3e0b9cb-24b5-4dcd-b68b-55350c0ee44c]: exited
[debug] [2020-05-23T01:57:20.009Z] DEBUG: [worker-~diagnostic~-b3e0b9cb-24b5-4dcd-b68b-55350c0ee44c]: FINISHED发布于 2020-05-23 10:22:56
您可以添加任何package.json类型的命令。
例如,nodemon.json
{
"signal": "SIGHUP",
"ext": "ts",
"exec": "npm run serve",
"watch": ["src"]
}https://stackoverflow.com/questions/61966548
复制相似问题