I have a firebase project I've been maintaining for months and haven't had any problems with.
I've tried running firebase deploy multiple times to no avail. I've googled it and searched on SO, github, and others, found these links, none of which worked. I've tried updating firebase tools, uninstalling and reinstalling, and everything between. Please don't blindly flag as duplicate without reading.
The first line of my error looks like this:
\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\lib\winston\logger.js:307
throw ex;
Here's my full output:
firebase deploy
C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\lib\winston\logger.js:307
throw ex;
^
Error: write after end
at writeAfterEnd (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\node_modules\readable-stream\lib_stream_writable.js:261:12)
at PassThrough.Writable.write (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\node_modules\readable-stream\lib_stream_writable.js:305:21)
at File.log (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\lib\winston\transports\file.js:185:34)
at File._write (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston-transport\index.js:103:17)
at doWrite (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\readable-stream\lib_stream_writable.js:428:64)
at writeOrBuffer (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\readable-stream\lib_stream_writable.js:417:5)
at File.Writable.write (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\readable-stream\lib_stream_writable.js:334:11)
at DerivedLogger.ondata (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\node_modules\readable-stream\lib_stream_readable.js:681:20)
at DerivedLogger.emit (events.js:203:15)
at DerivedLogger.EventEmitter.emit (domain.js:448:20)
at addChunk (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\node_modules\readable-stream\lib_stream_readable.js:298:12)
at readableAddChunk (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\node_modules\readable-stream\lib_stream_readable.js:280:11)
at DerivedLogger.Readable.push (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\node_modules\readable-stream\lib_stream_readable.js:241:10)
at DerivedLogger.Transform.push (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\node_modules\readable-stream\lib_stream_transform.js:139:32)
at DerivedLogger._transform (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\lib\winston\logger.js:305:12)
at DerivedLogger.Transform._read (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\node_modules\readable-stream\lib_stream_transform.js:177:10)
I'm completely stuck on this, I've been searching for an hour, and I've never had this fail for me before, so I don't know what's going on with firebase. Thanks in advance.
For others that come this way, I had this exact error message and stack trace. I was attempting to run firebase deploy --except functions while following this code lab step.
For me the fix was simply to stop serving the firebase app locally for debug.
Once I had done this, no reboot, just back in the other terminal and submit the deploy command and it worked fine.
The code lab gets you to do this and then leave it served locally while changing various parts of the app, but I have no idea what caused winston to conflict this way.
This probably an issue with NPM try running npm cache clean and reinstall firebase tools. If that didn't work try contacting firebase support. Recently I ran into an issue with firebase hosting and they were really helpful but took about 30 hours for their response after making the support ticket.
I had the exact same error, I tried restarting Command Prompt, deleting the cache file in the .firebase project folder. deploy worked fine with a separate test project.
On a whim I shut down my local server, and firebase deploy worked fine. Not sure if that's the real fix, as I'm 99.9% sure I did deploys in the past with the local server running... but it works for me now.
And after deploy was working again, it stopped a second time with the same error. So I stopped the server, and once again deploy worked. Then if failed a third time, same fix, shut down the local server.
Local server was run via firebase serve --only hosting
npm cache verify also checked out A-OK:
https://docs.npmjs.com/cli-commands/cache.html
Related
I'm new to next.js and react. I have created a simple application and would like to serve it using pm2 and Apache.
When I run npm run dev in the folder of the next project, the server starts and I can see my application on port 3000 of localhost.
However, when pm2 attempts to run the application (I have set it to run on server boot), I get the following error in the pm2 logs:
SyntaxError: Unexpected token '<'
at ESMLoader.moduleStrategy (node:internal/modules/esm/translators:119:18)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:468:14)
at async link (node:internal/modules/esm/module_job:67:21)
node --version is v16.19.0
npm --version is 8.19.3
Can someone help me to fix this issue? I don't understand why it is happening at the moment.
Without providing more information and context, it will be difficult to diagnose exactly what is going wrong. If you want good answers, you need to list out a more comprehensive list of things you've tried and information about how you are setting up nextjs with pm2.
But right now, the character is your best clue. "<" hints at the problem likely being that html markup is being loaded somewhere it shouldn't be.
I fixed it. I had neglected to build the project with npm run build. Once I'd done that, pm2 worked as desired.
I'm building an E-commerce site, where there's an Authentication system.
I noticed that if the client login with a wrong user or password, the backend/server that works with nodemon will crach and hang in there crashed till i restart manually nodemon. This is example output error of the nodemon crash:
[nodemon] app crashed - waiting for file changes before starting...
node:internal/errors:464
ErrorCaptureStackTrace(err);
^
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent
to the client
Ofcourse, when server crashes, client can no more access or do login again till server restarts.
After some googling, i found this question and this repository that fix my problem but particulary and not as expected precisely, i dont want nodemon to restart forever on any error that occure ofcourse, but only with specifics errors that i set them -like Authentication errors as i mentionned above-.
So, my idea/question is: is there anyway to get nodemon restarts by itself in some cases of failures or errors (NOT ALL)?
Seems like you a referring to a production situation, and nodemon is a development node server, which is not intended for use in production, as the intro states:
nodemon is a tool that helps develop Node.js based applications by
automatically restarting the node application when file changes in the
directory are detected.
You should use node.js in production, instead of nodemon.
For managing your node server in production, you could use a process manager like PM2..
That said, an authentication server that crashes every time a user uses a wrong password seams very ineffective in handling a common use case. So I would advise to start with fixing the root cause, which is the buggy server, and then for recovery from incidental crashes use something like PM2.
PS:
The error you are getting looks like an express error you get when you send a response (in this case an error response) without exiting the function e.g. by using return. Because you are not returning, another res.send is called, which causes the 'ERR_HTTP_HEADERS_SENT' error. See this answer.
This is really bad since it can send your program into a loop of restarting, but if you really want it, replace app.js with your file's name and try this:
nodemon -x 'node app.js || copy /b app.js +,,'
Linux version:
nodemon -x 'node app.js || touch app.js'
Next time try a little googleing before you ask since it is most likely faster.
I've spent the last 3 days trying to make a Ubuntu Oracle Cloud VPS a parse server (Yes, I know services like Google Firebase and Back4App but my website consume a lot of requests by a user/hour and I don't have money to spend right now), so I followed this tutorial:
https://dev.to/autodidaktum/how-to-deploy-parse-server-and-parse-dashboard-on-digital-ocean-2021-3o5h
I have followed every step just changing little things like node version (I got the most updated) and didn't create a network domain.
Everything ran "ok" (I had to install some packages and force the parse-server download) but when I reached the "Install Parse Server", the last part of it says to run npm index.js but npm returns with something like: "execute npm run lint", sounded really ok to me but when I ran it, returned me the message:
parse-server-example#1.4.0 lint
eslint --cache ./cloud && eslint --cache index.js && eslint --cache ./spec
and no reach from my browser from "{ip floating address}:1337" (yes, I know that {ip floating address} means the external IP), so I thought I was missing to open a port for access in both areas like inside the server and the Virtual Cloud Network, I opened them (images below) and still no reach.
I let it go and went to the "Install Parse Dashboard" step and started the server, nice message
The dashboard is now available at http://0.0.0.0:4040/
another browser test and still no reach. (obviously, I have tested with externalIp:4040)
The real question is, I did something wrong based on this information?
I'm trying to run Heroku applications locally via 'heroku local,' but a missing module error is occurring in the Heroku CLI. Is this a Heroku bug that just needs to be reported or is there something wrong with how things have been setup on my machine (mac)? Any suggestions are appreciated.
In order to ensure my application isn't the problem, I've been debugging this issue with the node application Heroku provides in its getting started guides. Meaning, it already has a Procfile that can be run using default settings.
Things I've tried:
Re-install node modules for both application and CLI
Re-install the Heroku CLI
Here's the error:
node-js-getting-started [master] :> heroku local
Error: Cannot find module '../../load-foreman-procfile'
at Object.<anonymous> (/usr/local/Cellar/heroku/7.26.1/libexec/node_modules/#heroku-cli/plugin-local/lib/commands/local/index.js:5:18)
The file for the route above requires a 'load-foreman-procfile' like so:
const Procfile = require('../../load-foreman-procfile');
That require path doesn't lead to a to file by that name. In fact, this is the only reference to 'load-foreman-procfile' I can find in '/usr/local/Cellar/heroku/7.26.1'.
Rather than the error code above, I would expect heroku local to yield a running local server started via my Procfile.
I got the same error running heroku-cli v7.26.0. I switched to their edge channel (currently v7.26.2) and heroku local worked for me after that.
like #sophon mentioned - updating from v7.26.0 to v7.26.2 solved this for me. heroku update on mac did the trick.
I'm trying to deploy my Django app on Heroku, that makes use of the Blockchain.info API V2 (https://github.com/blockchain/service-my-wallet-v3) and thus needs to run blockchain-wallet-service in the background, which in turn needs Node.js and npm installed.
On localhost, I have used this API successfully by running the service on my own machine, but I'm having trouble deploying to Heroku. Firstly, I assume I will need to run the service on a separate dyno, and that I will need node and npm installed on my instance.
Can someone tell me how to achieve this? I'm new to more advanced features of Heroku, I've tried to use the nodejs buildpack but I doubt this is the correct way. There is also this: https://elements.heroku.com/buttons/kmhouk/service-my-wallet-v3 which I've deployed as a separate app but I've failed to merge it in some way to my Django app.
Any help is much appreciated!
I had this exact same issue, bro, and i finally got some light in the end of the tunnel.
I've cloned the https://github.com/blockchain/service-my-wallet-v3 repository and deployed it to heroku and made some changes on "package.json" file. The problem is that (in heroku) you need to declare the dependencies on package file. I've added these lines:
"dependencies": {
"blockchain-wallet-service": "~0.22.4",
}
and a script to test in the deploy:
"scripts": {
"postinstall": "blockchain-wallet-service -V"
}
Also, by cloning this repository, i needed to add this line too:
"license" : "(ISC OR GPL-3.0)",
hope it works for you