首页 文章

安装nodejs时出现apt-get命令错误

提问于
浏览
0

我尝试使用apt-get install安装nodejs但是我收到以下错误

设置spamassassin(3.4.0-6)...错误:需要gpg但未找到!不推荐使用,但您可以使用“sa-update”和--no-gpg跳过验证 . dpkg:错误处理包spamassassin( - configure):安装后的子进程安装后脚本返回错误退出状态2 dpkg:依赖性问题阻止sa-compile的配置:sa-compile依赖于spamassassin(> = 3.3.2-8);但是:尚未配置包spamassassin .

dpkg:错误处理包sa-compile( - configure):依赖性问题 - 保持未配置没有写入apport报告,因为错误消息表明它是先前失败的后续错误 . 处理时遇到错误:spamassassin sa-compile E:子进程/ usr / bin / dpkg返回错误代码(1)

在此之后它终止 . 怎么解决?

1 回答

  • 1

    所以,我在前几次使用apt-get构建我正在进行开发的系统来安装node.js,但我很快就离开了它 . 能够只使用一行命令是好的和干净的,但apt存储库不会经常更新,然后您将链接到他们选择的版本,而不是您想要或已经测试过的版本 .

    我转而使用预编译的node.js可执行文件(在Ubuntu 12.04上使用节点0.8.21) . 为此,我将文件从Joyent的http://nodejs.org/dist/v0.8.21/node-v0.8.21-linux-x64.tar.gz下载到/home/username/Desktop/node-v08.21-linux-x64.tar.gz后,使用sudo从shell脚本或命令行运行以下命令:

    # untar the tar file to the directory /usr/local
    tar -xvf /home/username/Desktop/node-v0.8.21-linux-x64.tar.gz -C /usr/local
    
    # now create symbolic link in the /usr/local directory
    ln -s /usr/local/node-v0.8.21-linux-x64/bin/node /usr/local/bin/node
    ln -s /usr/local/node-v0.8.21-linux-x64/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm
    
    #now make the directory to hold the node modules npm and set permissions
    mkdir -p /usr/local/lib/node_modules
    chmod 755 /usr/local/lib/node_modules
    

    如果您所在的系统需要从头开始编译,可以从Joyent的http://nodejs.org/dist/v0.8.21/node-v0.8.21.tar.gz下载源代码,并从终端运行以下命令或使用sudo运行脚本来编译和部署节点:

    #install things we need to install node
    DEBIAN_FRONTEND=noninteractive apt-get install -y  build-essential python libssl-dev
    
    #create and move into directory to do the install from
    cd /home/username
    mkdir nodeInstallDirectory
    cd nodeInstallDirectory
    
    #copy the tarred install file out for node
    cp /home/username/Desktop/node-v0.8.21.tar.gz /home/username/nodeInstallDirectory/node-v0.8.21.tar.gz
    
    #untar, and move into directory for node code
    tar -xvf node-v0.8.21.tar.gz
    cd node-v0.8.21
    
    #these next three lines do the install itself
    ./configure
    make -j 5
    make install
    

    这些指令也适用于以后或早期的Node.js版本 .

相关问题