1

I develop node.js application on typescript, and I want to deploy app to the server with pm2 deploy.
I don't have sudo access on the server, so i can't just install npm packages globally.
According to npm documentation, i've changed my npm's default directory to ~/.npm-global and install typescript globally with npm i -g typescript.
My ecosystem.config.js deploy section looks like:

deploy: {
    production: {
        'user': "user",
        'host': "example.com",
        'repo': "https://github.com/username/repo.git",
        'path': "/home/projects/project/",  
        'post-deploy': "npm install && tsc && pm2 reload ecosystem.config.js --env production"
    }
}

When I run tsc on server througt ssh it works, but when I run pm2 deploy production update, it says:

bash: tsc: command not found
post-deploy hook failed

I also tried NVM, it doesn't work too.

Yura
  • 2,925
  • 2
  • 18
  • 27

0 Answers0