-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Unexpected token < in JSON at position 0 . #504
Comments
I am use last version of truffle .The deploy and test work perfectly. |
As a note I had this error and fixed it myself. The problem was that my contract (as defined in the .sol file) had a different name than the solidity file itself. So for example: FirstContract.sol and inside that file: contract MyFirstContract () {}...... It seems that the contract name and the file name need to be the same. Not sure how the behavior will change when there are more than one contracts in the file, however this fixed the error for me. |
This seem to happen when the json parser expects a json but receives a different format. In this case it's probably getting an html error response. One must look deeper and find the underlying issue. It could be a name mismatch as the above comment, or that contract instance is not actually deployed in the current network, even thought it's deployment info is stored in its build .json file. In my case I deployed a contract to a ganache network. When I reset the network to the genesis state, Truffle calls tries to call the method again for the saved contract address but does not receive a proper response. |
I am use last version of truffle .The deploy and test work perfectly.
When i use node with application i receive following problem:
Unexpected token < in JSON at position 0
The problem is connected to web3 version because i receive error web3 trying to get network id.
I upgraded web3 to version 0.18.4 and problem disapiared but now after upgrading one of module it's appiars again.
O am running on OSX
i am adding my dependence list from node (Local and global)
If somebody can help me.
Issue
What the issue is, in broad strokes.
Steps to Reproduce
Please provide the shortest amount of steps to reproduce your issue.
Expected Behavior
What you expected to happen.
Actual Results
What actually happened. Please give examples and support it with screenshots, copied output or error messages.
Environment
Operating System:
uname -a
Darwin MacBook-Pro 16.6.0 Darwin Kernel Version 16.6.0: Fri Apr 14 16:21:16 PDT 2017; root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64
Truffle version:
truffle version
Truffle v3.4.5 (core: 3.4.5)
Solidity v0.4.11 (solc-js)
Ethereum client:
node version:
node -v
v8.1.4
npm version:
npm -v
5.0.3
npm_global_list.txt
npm_lis_ver.txt
The text was updated successfully, but these errors were encountered: