I'm facing an issue while setting up my NextJS
application in TypeScript on my hosting server. On my local machine, everything works fine when I run next build
. However, on the server, I'm encountering this error:
> next build
It seems that TypeScript is not installed on your system.
To resolve this, please install typescript by running:
npm install --save-dev typescript
If you're not using TypeScript, make sure to remove the tsconfig.json file from the package root (and any TypeScript files in the pages directory).
I've tried installing TypeScript with both:
npm install --save-dev typescript
and npm -g typescript
, but the error persists.
Here's a snippet from my package.json
:
...
"scripts": {
// Your scripts here
},
"dependencies": {
// Your dependencies here
},
"devDependencies": {
// Your dev dependencies here
}
...
Both my local computer and the server are running Node 16.15.1
. The server uses pm2
to execute the script (I even tried running it manually through SSH, but the error remains).
I can't figure out why this error is occurring despite having TypeScript installed. Any help would be appreciated!