ubuntu 16.04 安装nodejs 以及问题整理

来源:互联网 发布:金庸 误解 知乎 编辑:程序博客网 时间:2024/06/05 21:15

添加官方源

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'

解决方法:

  1. 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
原创粉丝点击