[Express] 安裝node.js和nvm

[Express] 安裝node.js和nvm

  • 安裝node:
    $ brew install node      
    ...
    Warning: The post-install step did not complete successfully
    You can try again using `brew postinstall node`
    ...
    $ sudo chown -R (whoami) $(brew --prefix)/*
    Password:
    輸入完密碼,再次測試 node -v
    $ node -v
    Unknown command ‘node’
    $ brew install node 
    Warning: node 12.1.0 is already installed, it's just not linked
    You can use `brew link node` to link this version
    $ brew link node 
    Linking /usr/local/Cellar/node/12.1.0...
    Error: Could not symlink include/node/common.gypi
    Target /usr/local/include/node/common.gypi
    already exists. You may want to remove it:
    rm '/usr/local/include/node/common.gypi'
    To force the link and overwrite all conflicting files:
    brew link --overwrite node
    To list all files that would be deleted:
    brew link --overwrite --dry-run node
    根據建議執行 brew link — overwrite node
    $ brew link — overwrite node
    Linking /usr/local/Cellar/node/12.1.0…
    Error: Could not symlink include/node/common.gypi
    /usr/local/include/node is not writable.
    權限不足無法覆寫,改檔案權限再試一次
    $ sudo rm ‘/usr/local/include/node’
    $ sudo chown -R $USER /usr/local 
    $ brew link --overwrite node 
    $ npm