NPM won't install any package on Mac. New, clean build. `EACCES` & other errors

前端 未结 6 944
野性不改
野性不改 2021-02-07 15:32

I\'ve just rebuild my Mavericks (Mac OS X Version 9.4) machine from scratch. I am the administrator and only user of this machine.

  • I installed Git via their
6条回答
  •  一向
    一向 (楼主)
    2021-02-07 15:50

    to start fresh remove prior node.js and npm installs as well as these :

    ~/.npmrc ~/.npm ~/tmp ~/.npm-init.js

    to install nodejs and npm as yourself NOT root do these commands (linux) :

    mkdir ${HOME}/bin
    

    download source from : http://nodejs.org/download/

    cd v0.10.30/
    
    ./configure   --prefix=${HOME}/bin/nodejs
    
    make -j8
    make install
    

    which puts it into dir defined by above --prefix

    export PATH=${HOME}/bin/nodejs/bin:$PATH
    

    NODE_PATH so node can find dir for modules otherwise npm install xxx will put newly installed module into dir in curr dir :

    export NODE_PATH=${HOME}/bin/nodejs/lib/node_modules
    

    do above AND use syntax : npm install xxxxx -g always use the -g for global

    nodejs install gives you npm as well :

    ls -la ${HOME}/bin/nodejs/bin
    

提交回复
热议问题