node.jslinuxnpm-installparse-servernpm-init

What is the proper way of using npm in root environment?


I'm currently setting up a Parse Server with AWS EC2 instance, where I've been using Nginx and Elastic IP to manage SSL certificates. Through different guides I've reached the solution of put the node app at /var/www/parse-server, but they say I should do 'npm init' in this directory, which is obviously owned by root (and fails because of permissions, of course).

My question is about the proper way of manipulate the app files in this root path, specially because 'sudo npm init' has conflicts with packages when the project keep moving on.


Solution

  • I found two workarounds for this:

    1. chown -R to change the directory owner to my own user. This works but i think is not the proper way.
    2. Proxy reverse to the specific folder (i'm using nginx, so whoever is watching this thread should be fine with nginx docs)

    Thanks to Davi Macedo for solution 1.