1

I copied my system developed in ExpressJs to the production server. My system uses HTTPS (SSL).

When the return is 400, 403, 404, or some code purposely so, it responds correctly with a JSON.

When the return should be 200, the node displayed an error in the console "Illegal instruction (core dumped)" and breaks the application.

3 Answers 3

3

It seems that you copied the node_modules instead of moving everything else and running npm install to install dependencies.

Update: Now after you posted your answer I see that it was precisely the case.

The problem is that some of the modules have compiled binary components that cannot be moved across different architectures. They need to be build every time so you never should copy the node_modules directory.

But if you do copy the node_modules directory or if you update Node.js in your system then instead of removing node_modules and running npm install you can run npm rebuild instead. (Thanks to mscdex for pointing it out in the comments.)

Sign up to request clarification or add additional context in comments.

1 Comment

Or you can just do npm rebuild IIRC, which would save you some time.
1

I solved the problem, delete the folder node_modules and run npm install

Comments

0

The final solution that helped me was to upgrade Node to the latest LTS (in my case, I used nvm), and upgraded npm using npm install -g npm and yarn npm install -g yarn & npm upgrade -g yarn.

If you're using screen or any background processes, make sure these processes use the latest node, npm, and yarn version as well (this part gave me a headache for an hour, hope it doesn't happen to anyone else).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.