Web3.eth.sign() method problem

I am using infura and web3 0.20.0 in back-end.(nodejs, I don’t want to interact with metamask(front-end)) Now, I am facing a problem. I tried to use ERC865.

 solidity

function recoverPreSignedHash(
    address _token,
    bytes4 _functionSig,
    address _spender,
    uint256 _value,
    uint256 _fee,
    uint256 _nonce
    )
  public pure returns (bytes32)
  {
    //return keccak256(_token, _functionSig, _spender, _value, _fee, _nonce);
    return keccak256(abi.encodePacked(_token, _functionSig, _spender, _value, _fee, _nonce));
}

Blockquote

var Tx = require('ethereumjs-tx');
var Web3 = require('web3');
const testnet = 'https://ropsten.infura.io/';
const web3 = new Web3(new Web3.providers.HttpProvider(testnet));
var contractAddress = '0xf21BF631C...';
var contractABI = [{"constant":true,"inputs":[],"................}]
var contract = web3.eth.contract(contractABI).at(contractAddress);
var transferSig = "0x48664c16";
var to = "0x36C906644FEbA405...";
var val = 100*Math.pow(10, 18);
var fee = 20*Math.pow(10, 18);
var nonce =web3.eth.getTransactionCount("0xD0A8800973cb...");
contract.recoverPreSignedHash(contractAddress, transferSig, to, val, fee, nonce, function(error, hash) {
    if (!error) {
        web3.eth.sign("0xD0A8800973cbEF2639Eb...", hash, function(error, signature) {
        if (!error) {
            console.log(hash);
            console.log(signature);
        } else {
            console.log(error);
        }
     });
    } else {
    console.log(error);
    }
});

But it returns"Error: The method eth_sign does not exist/is not available" Because Infura does not have private key, so it doesn’t have sign method. This problem is as same as sendTransaction so I use sendRawTransaction. How do I solve “sign” problem? (nodejs & web 0.20.0) How do I sign this hash Manually?(I have private key) What is “web3.eth.sign()” machanism?

You are correct in your understanding that in order to directly send a transaction to Ethereum through Infura you need to locally sign the transaction using your private key and then use eth_sendRawTransaction

You might find this article useful for how to create Raw Transactions using NodeJS:

I just want to call “recoverPreSignedHash” and “web3.eth.sign”
Is this a transaction? I think it’s not a transaction. Just call “recoverPreSignedHash”, use output “hash” and “address” to make signature.
And the problem is web3.eth.sign method isn’t exist.