NodeJS npm install pg failed

前端 未结 3 1913
离开以前
离开以前 2020-12-31 21:28

Im trying to npm install pg on my ubuntu virtual machine and i got error:

> pg@1.1.0 install /usr/local/lib/node_modules/core/node_modules/pg
> node-gy         


        
相关标签:
3条回答
  • 2020-12-31 22:22

    Try running the following commands and then run npm install, this will take the node's default node-gyp module. (No need to have multiple as node package already provides that)

    Updating the node & NPM

    sudo npm cache clean -f
    sudo npm install -g n
    sudo n 4.4.5
    sudo npm install npm -g
    

    Removing additional Node-gyp module

    sudo npm uninstall node-gyp -g
    sudo npm uninstall node-gyp
    
    0 讨论(0)
  • 2020-12-31 22:25

    Try to install node-gyp first into the global scope?

    sudo npm -g install node-gyp
    

    You should get a result (after all the tgz's are pulled in) that looks like this

    /usr/local/bin/node-gyp -> /usr/local/lib/node_modules/node-gyp/bin/node-gyp.js
    node-gyp@0.12.1 /usr/local/lib/node_modules/node-gyp
    ├── osenv@0.0.3
    ├── graceful-fs@2.0.1
    ├── mkdirp@0.3.5
    ├── which@1.0.5
    ├── rimraf@2.2.5
    ├── semver@2.2.1
    ├── npmlog@0.0.6 (ansi@0.2.1)
    ├── nopt@2.1.2 (abbrev@1.0.4)
    ├── glob@3.2.7 (inherits@2.0.1)
    ├── fstream@0.1.25 (inherits@2.0.1)
    ├── minimatch@0.2.12 (sigmund@1.0.0, lru-cache@2.5.0)
    ├── tar@0.1.19 (inherits@2.0.1, block-stream@0.0.7)
    └── request@2.29.0 (json-stringify-safe@5.0.0, forever-agent@0.5.0, aws-sign2@0.5.0, qs@0.6.6, tunnel-agent@0.3.0, oauth-sign@0.3.0, node-uuid@1.4.1, mime@1.2.11, tough-cookie@0.9.15, http-signature@0.10.0, hawk@1.0.0, form-data@0.1.2)
    
    0 讨论(0)
  • 2020-12-31 22:33

    I have installed libpq-dev library

    sudo apt-get install libpq-dev
    

    it helped ;)

    0 讨论(0)
提交回复
热议问题