When I am trying to deploy my smart contract(It is a 600+ lines smart contract)through truffle framework (version 4.1.14) on Rinkeby testnet it is showing the above error.But when I am deploying the same contract with remix ide and using metal mask then it is deployed successfully. I know that the code size limit of 32KB is in ethereum-go implementation to avoid DOS attack.So if anyone can answer why the contract is getting deployed with remix but not with truffle. Here is the link on rinkbey testnet https://rinkeby.etherscan.io/tx/0xe42b8fa9a7aab732a633465a84e8a56433eb482e0cb5aa49ed38f5428dfc82a4
My guess would be that you have optimisation turned on in remix, but not in Truffle. This would mean that under remix the code size is small enough to deploy, but not under Truffle.
You can add something like:
to truffle.js to turn on optimisation. There is switch under settings in remix that does the same thing.