美文网首页
mac 安装node出现的问题

mac 安装node出现的问题

作者: 马_黎 | 来源:发表于2019-11-08 16:14 被阅读0次

    mac通过brew安装完node 但是无法识别的问题

    描述:

    在一次开发中,先通过brew install 安装完node,可以正常使用,这时候给卸载掉,又通过安装包进行安装。安装完以后,又卸载了,再通过brew安装。问题出现了,安装成功,但是node-v提示不识别node。

    提示错误信息:

    Linking /usr/local/Cellar/node/11.2.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
    localhost:wkdir meng$ brew link --overwrite node
    Linking /usr/local/Cellar/node/11.2.0...
    Error: Could not symlink include/node/common.gypi
    /usr/local/include/node is not writable.
    

    解决

    运行下面代码,查看冲突

    brew link --overwrite --dry-run node
    

    下面的代码结果:

    Would remove:
    /usr/local/include/node/common.gypi
    /usr/local/include/node/config.gypi
    /usr/local/include/node/libplatform/libplatform-export.h
    /usr/local/include/node/libplatform/libplatform.h
    /usr/local/include/node/libplatform/v8-tracing.h
    /usr/local/include/node/node.h
    /usr/local/include/node/node_api.h
    /usr/local/include/node/node_api_types.h
    /usr/local/include/node/node_buffer.h
    /usr/local/include/node/node_object_wrap.h
    /usr/local/include/node/node_version.h
    /usr/local/include/node/openssl/aes.h
    /usr/local/include/node/openssl/asn1.h
    /usr/local/include/node/openssl/asn1_mac.h
    /usr/local/include/node/openssl/asn1t.h
    /usr/local/include/node/openssl/bio.h
    /usr/local/include/node/openssl/blowfish.h
    /usr/local/include/node/openssl/bn.h
    /usr/local/include/node/openssl/buffer.h
    /usr/local/include/node/openssl/camellia.h
    /usr/local/include/node/openssl/cast.h
    /usr/local/include/node/openssl/cmac.h
    /usr/local/include/node/openssl/cms.h
    /usr/local/include/node/openssl/comp.h
    /usr/local/include/node/openssl/conf.h
    /usr/local/include/node/openssl/conf_api.h
    /usr/local/include/node/openssl/crypto.h
    /usr/local/include/node/openssl/des.h
    /usr/local/include/node/openssl/dh.h
    /usr/local/include/node/openssl/dsa.h
    /usr/local/include/node/openssl/dtls1.h
    /usr/local/include/node/openssl/e_os2.h
    /usr/local/include/node/openssl/ebcdic.h
    /usr/local/include/node/openssl/ec.h
    /usr/local/include/node/openssl/ecdh.h
    /usr/local/include/node/openssl/ecdsa.h
    /usr/local/include/node/openssl/engine.h
    /usr/local/include/node/openssl/err.h
    /usr/local/include/node/openssl/evp.h
    /usr/local/include/node/openssl/hmac.h
    /usr/local/include/node/openssl/idea.h
    /usr/local/include/node/openssl/lhash.h
    /usr/local/include/node/openssl/md4.h
    /usr/local/include/node/openssl/md5.h
    /usr/local/include/node/openssl/mdc2.h
    /usr/local/include/node/openssl/modes.h
    /usr/local/include/node/openssl/obj_mac.h
    /usr/local/include/node/openssl/objects.h
    /usr/local/include/node/openssl/ocsp.h
    /usr/local/include/node/openssl/opensslconf.h
    /usr/local/include/node/openssl/opensslv.h
    /usr/local/include/node/openssl/ossl_typ.h
    /usr/local/include/node/openssl/pem.h
    /usr/local/include/node/openssl/pem2.h
    /usr/local/include/node/openssl/pkcs12.h
    /usr/local/include/node/openssl/pkcs7.h
    /usr/local/include/node/openssl/rand.h
    /usr/local/include/node/openssl/rc2.h
    /usr/local/include/node/openssl/rc4.h
    /usr/local/include/node/openssl/ripemd.h
    /usr/local/include/node/openssl/rsa.h
    /usr/local/include/node/openssl/safestack.h
    /usr/local/include/node/openssl/seed.h
    /usr/local/include/node/openssl/sha.h
    /usr/local/include/node/openssl/srp.h
    /usr/local/include/node/openssl/srtp.h
    /usr/local/include/node/openssl/ssl.h
    /usr/local/include/node/openssl/ssl2.h
    /usr/local/include/node/openssl/ssl3.h
    /usr/local/include/node/openssl/stack.h
    /usr/local/include/node/openssl/symhacks.h
    /usr/local/include/node/openssl/tls1.h
    /usr/local/include/node/openssl/ts.h
    /usr/local/include/node/openssl/txt_db.h
    /usr/local/include/node/openssl/ui.h
    /usr/local/include/node/openssl/whrlpool.h
    /usr/local/include/node/openssl/x509.h
    /usr/local/include/node/openssl/x509_vfy.h
    /usr/local/include/node/openssl/x509v3.h
    /usr/local/include/node/uv.h
    /usr/local/include/node/v8-platform.h
    /usr/local/include/node/v8-profiler.h
    /usr/local/include/node/v8-testing.h
    /usr/local/include/node/v8-util.h
    /usr/local/include/node/v8-value-serializer-version.h
    /usr/local/include/node/v8-version-string.h
    /usr/local/include/node/v8-version.h
    /usr/local/include/node/v8.h
    /usr/local/include/node/v8config.h
    /usr/local/include/node/zconf.h
    /usr/local/include/node/zlib.h
    /usr/local/share/doc/node/gdbinit
    /usr/local/share/doc/node/lldb_commands.py
    /usr/local/share/systemtap/tapset/node.stp
    /usr/local/lib/dtrace/node.d
    

    删除上面所有的冲突文件以后,执行下面代码。

    brew link --overwrite node

    如果还是继续报下面的错

    Error: Could not symlink share/systemtap/tapset/node.stp
    /usr/local/share/systemtap/tapset is not writable.
    

    执行赋予权限的代码:

    chown -R mali:admin /usr/local/share/systemtap/

    然后就搞定了:

    malideMacBook-Pro:bin mali$ brew link --overwrite node
    Linking /usr/local/Cellar/node/12.12.0... 7 symlinks created
    malideMacBook-Pro:bin mali$ node -v
    v12.12.0

    相关文章

      网友评论

          本文标题:mac 安装node出现的问题

          本文链接:https://www.haomeiwen.com/subject/zbhwbctx.html