Error on typescript compiling

stuartsesTRIAL

4 months ago

I've got this error when the command "npm run build" is used.
This is working fine locally and docker locally as well

this is my dockerfile:

# syntax=docker/dockerfile:1

ARG NODE_VERSION=18.16.0-alpine

FROM node:${NODE_VERSION}

WORKDIR /app

COPY package*.json ./

RUN ls -la /app

RUN npm install

COPY . .

RUN ls -la /app

RUN npm run build

ENV NODE_ENV=production
ENV DATABASE_URL="mongodb://mongo...."

EXPOSE 3000

CMD ["npm", "start"]

a section of my package.json

 "devDependencies": {
    "@eslint/js": "^9.18.0",
    "@types/express": "^5.0.0",
    "@types/jest": "^29.5.14",
    "@types/mongoose": "^5.11.97",
    "@types/node": "^22.10.6",
    "@typescript-eslint/eslint-plugin": "^8.20.0",
    "@typescript-eslint/parser": "^8.20.0",
    "eslint": "^9.18.0",
    "eslint-config-prettier": "^10.0.1",
    "eslint-plugin-prettier": "^5.2.2",
    "globals": "^15.14.0",
    "jest": "^29.7.0",
    "nodemon": "^3.1.9",
    "prettier": "^3.4.2",
    "ts-jest": "^29.2.5",
    "ts-node": "^10.9.2",
    "typescript": "^5.7.3",
    "typescript-eslint": "^8.20.0"
  },
  "dependencies": {
    "dotenv": "^16.4.7",
    "express": "^4.21.2",
    "mongoose": "^8.9.5"
  }

and a section of my package-lock

"packages": {
    "": {
      "name": "inventory-management",
      "version": "1.0.0",
      "license": "ISC",
      "dependencies": {
        "dotenv": "^16.4.7",
        "express": "^4.21.2",
        "mongoose": "^8.9.5"
      },
      "devDependencies": {
        "@eslint/js": "^9.18.0",
        "@types/express": "^5.0.0",
        "@types/jest": "^29.5.14",
        "@types/mongoose": "^5.11.97",
        "@types/node": "^22.10.6",
        "@typescript-eslint/eslint-plugin": "^8.20.0",
        "@typescript-eslint/parser": "^8.20.0",
        "eslint": "^9.18.0",
        "eslint-config-prettier": "^10.0.1",
        "eslint-plugin-prettier": "^5.2.2",
        "globals": "^15.14.0",
        "jest": "^29.7.0",
        "nodemon": "^3.1.9",
        "prettier": "^3.4.2",
        "ts-jest": "^29.2.5",
        "ts-node": "^10.9.2",
        "typescript": "^5.7.3",
        "typescript-eslint": "^8.20.0"
      }
    },

Have you ever have this kind of error?

View Deploy details

ⓘ Deployment information is only viewable by project members and Railway employees.

1 Replies

stuartsesTRIAL

4 months ago

this is part of the error log. There is not error locally

```
npx tsc

Jan 22 14:37:31

src/config.ts(1,1): error TS1127: Invalid character.

Jan 22 14:37:31

src/config.ts(1,2): error TS1127: Invalid character.

Jan 22 14:37:31

src/config.ts(1,3): error TS1127: Invalid character.
```