1

I have a firebase/react program that I am sharing with some friends via github for a project. All of their devices do not have the same issue that I am experiencing.

In the scripts portion of my package.json, i have the line

"start": "node ./src/server.js" 

which is very standard. However, running this line gives me a very strange error:

RangeError [ERR_BUFFER_OUT_OF_BOUNDS]: "length" is outside of buffer bounds at proto.utf8Write (node:internal/buffer:1066:13)

followed by many other lines. I have learned from my research that this often comes with issues regarding node/npm installations.

Here is the strange part. When I put "node ./src/server.js" alone in the terminal, the program starts fine! Only when i try to do npm start does the program fail, even though the start script is identical.

The steps I have taken in an attempt to fix this problem are as follows:

  • Messed with nvm to match the node version my friends were using to no avail
  • Updated npm
  • Deleted and recloned the repo several times
  • Deleted and reinstalled node.js several times after deleting nvm
  • Performed many deletions of node_modules and package-lock.json

The only step that yielded results was the repo deletion, but it only prolonged the error to display at a later time.

8
  • 1
    Sounds like your npm command might be using a different node executable Commented May 8 at 4:26
  • stackoverflow.com/questions/78911536/… github.com/protobufjs/protobuf.js/issues/2025 seems you'll have to play with the node version maybe Commented May 8 at 4:56
  • Which node version? The question needs more debugging details. Check "node -v" in command line and inside the script. Make sure the project doesn't have "node" dependency that can be used for local node version Commented May 8 at 10:21
  • My node version is 22.15.0 (updated to the latest), and my npm is 11.3.0. Using nvm, I tried 20.7.0, 22.13.0, 22.7.0, 22.8.0, and 22.15.0, but for some reason, after each error, it would display the node version 22.7.0. What's weird is that immediately after that error message, if I wrote node -v, it would return the node version from nvm that I was on. Commented May 9 at 0:46
  • Try specifying a version in the terminal using nvm use {version} and then check using which node to verify Commented May 9 at 4:58

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.