13 days ago
Service keeps crashing with the below error:
Failed to initialize provider node: error reading package.json: hujson: line 1, column 1: invalid character '\ufeff' at start of value.
The package.json on GitHub has been updated and is:
{
"name": "projectname",
"version": "1.0.0",
"scripts": {
"start": "cd backend && npm start"
}
}
but seems it keeps using a cached file rather than the new file from GitHub. Not sure though but can't get it start.
Pinned Solution
13 days ago
The error is not from a stale cache. The issue is the package.json still contains a UTF-8 BOM character at the beginning of the file.
This part of the error confirms it:
invalid character '\ufeff' at start of value\ufeff = Byte Order Mark (BOM)
So there is an invisible character before the first {.
Fix:
- Open
package.json - Remove everything before the first
{ - Save the file as:
- UTF-8 (without BOM)
Examples by editor:
- VS Code
- Bottom right encoding label
- Click it
- “Save with Encoding”
- Choose
UTF-8
- Notepad++
- Encoding → Convert to UTF-8 (not UTF-8 BOM)
- JetBrains IDEs
- File Encoding → UTF-8
- Ensure “with BOM” is unchecked
If someone solves your problem, be a good community member and mark their reply as the solution <3
3 Replies
Status changed to Open Railway • 13 days ago
13 days ago
The error is not from a stale cache. The issue is the package.json still contains a UTF-8 BOM character at the beginning of the file.
This part of the error confirms it:
invalid character '\ufeff' at start of value\ufeff = Byte Order Mark (BOM)
So there is an invisible character before the first {.
Fix:
- Open
package.json - Remove everything before the first
{ - Save the file as:
- UTF-8 (without BOM)
Examples by editor:
- VS Code
- Bottom right encoding label
- Click it
- “Save with Encoding”
- Choose
UTF-8
- Notepad++
- Encoding → Convert to UTF-8 (not UTF-8 BOM)
- JetBrains IDEs
- File Encoding → UTF-8
- Ensure “with BOM” is unchecked
If someone solves your problem, be a good community member and mark their reply as the solution <3
Status changed to Awaiting User Response Railway • 13 days ago
13 days ago
Hello bvidarsson,
your package.json has a bom character (byte order mark) at the very start of the file you can see it in your own paste as the invisible character before the opening brace the error '\ufeff' literally means bom. railway is reading the file correctly, it is not a caching issue
to fix it open package.json in vs code, look at the bottom right corner where it says "utf-8 with bom", click it, choose "save with encoding" and pick "utf-8" without bom, then commit and push to github and redeploythe error will be gone
Hope this help you :)
Status changed to Awaiting Railway Response Railway • 13 days ago
Status changed to Awaiting User Response Railway • 13 days ago
13 days ago
Converting to UTF-8 (not UTF-8 BOM) with Notepad ++ did the trick. Thanks!
Status changed to Solved brody • 11 days ago