`node-pre-gyp install --fallback-to-build` failed during MeanJS installation on OSX

后端 未结 16 2185
遇见更好的自我
遇见更好的自我 2020-12-13 23:59

I just bought myself a mac book after using Windows for a long time.

I was trying to work on a MeanJS project that I had been working on. Doing npm install

16条回答
  •  [愿得一人]
    2020-12-14 00:32

    are you running the example from the node_modules folder?

    They are not supposed to be ran from there.

    Create the following file on your project instead:

    post-data.js

    var Curl = require( 'node-libcurl' ).Curl,
       querystring = require( 'querystring' );
    
    var curl = new Curl(),
      url  = 'http://posttestserver.com/post.php',
    data = { //Data to send, inputName : value
        'input-arr[0]' : 'input-arr-val0',
        'input-arr[1]' : 'input-arr-val1',
        'input-arr[2]' : 'input-arr-val2',
        'input-name' : 'input-val'
    };
    
    //You need to build the query string, 
    // node has this helper function, but it's limited for real use cases (no support for 
    array values for example)
    data = querystring.stringify( data );
    
     curl.setOpt( Curl.option.URL, url );
     curl.setOpt( Curl.option.POSTFIELDS, data );
     curl.setOpt( Curl.option.HTTPHEADER, ['User-Agent: node-libcurl/1.0'] );
     curl.setOpt( Curl.option.VERBOSE, true );
    
     console.log( querystring.stringify( data ) );
    
     curl.perform();
    
     curl.on( 'end', function( statusCode, body ) {
    
    console.log( body );
    
    this.close();
    });
    
    curl.on( 'error', curl.close.bind( curl ) );
    

    Run with node post-data.js

    ref:https://github.com/JCMais/node-libcurl/issues/98

提交回复
热议问题