apt-get install git -y
wget -qO- https://raw.github.com/creationix/nvm/master/install.sh | sh #wget方式安装nvm
npm install -g hexo-cli是出现错误提示node: Permission denied，可以在这里看到相关的讨论和解决方案。
ljharb commented on 5 Mar
The common thread seems to be global packages that have postinstall scripts that check/fix permissions. I would still suspect that it’s because you’re root - npm runs postinstall scripts as nobody for safety.
crazy4groovy commented on 6 Mar
Let’s call this one fixed! :)
I followed the instructions here to create a sudo user (called it worker1): https://www.digitalocean.com/community/tutorials/how-to-create-a-sudo-user-on-ubuntu-quickstart
Then reinstalled nvm in that account.Then:
worker1@ubuntu:~$ npm install testcafe
email@example.com postinstall /home/worker1/node_modules/testcafe-browser-tools
File permissions fixed
. . .
I don’t fully understand the ramifications of using a non-root user, but it’s enough to nod my head, cheer, and move along :) Thanks for your help working through this; muchly appreciated kind sir! 👍 May others find this useful as well.