添加官方源
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
安装nodejs
sudo apt-get install -y nodejs
npm安装puppeteer失败
运行命令 npm install -g puppeteer 出现如下错误
npm install -g puppeteer returns the following error: Download failed: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/puppeteer/.local-chromium'
解决方法:
- Make a directory for global installations:
mkdir ~/.npm-global
2.Configure npm to use the new directory path:
npm config set prefix '~/.npm-global'
3.Open or create a ~/.profile file and add this line:
export PATH=~/.npm-global/bin:$PATH
4.Back on the command line, update your system variables:
source ~/.profile