My main objective is to convert TypeScript code to JavaScript. However, when I attempted to install the TypeScript compiler globally using 'npm install -g tsc', I encountered the following error:
npm ERR! Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/tsc' -> '/usr/local/lib/node_modules/.tsc-8BsQC1RP'
To resolve this issue, I tried running the command with admin privileges by using 'sudo npm install -g tsc'. The installation was successful without any errors. But even after that, when I ran the 'tsc' command again, I faced an error.
The error message displayed: "This is not the tsc command you are looking for. To gain access to the TypeScript compiler, tsc, through the command line, you can either:
- Install TypeScript in your project first using 'npm install typescript' and then use 'npx'
- Use 'yarn' to prevent accidental execution of code from uninstalled packages
My ultimate goal remains to convert TypeScript files to JavaScript successfully.