Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

TypeError: Cannot read property 'put' of undefined #1194

Closed
barnendu opened this issue Jan 27, 2018 · 5 comments
Closed

TypeError: Cannot read property 'put' of undefined #1194

barnendu opened this issue Jan 27, 2018 · 5 comments
Labels
kind/support A question or request for support

Comments

@barnendu
Copy link

barnendu commented Jan 27, 2018

Version: 0.27.7
Platform:
ProductName: windows 10
ProductVersion:
BuildVersion:
Type: Bug
Severity: Medium
Description:
Getting TypeError: Cannot read property 'put' of undefined

Steps to reproduce the error:
› node src/index.js

C:\Users\Raju\test-ipfs\node_modules\ipfs-block-service\src\index.js:64
this._repo.blocks.put(block, callback)
^

TypeError: Cannot read property 'put' of undefined
at BlockService.put (C:\Users\Raju\test-ipfs\node_modules\ipfs-block-service\src\index.js:64:23)
at waterfall (C:\Users\Raju\test-ipfs\node_modules\ipld-resolver\src\index.js:390:28)
at nextTask (C:\Users\Raju\test-ipfs\node_modules\ipld-resolver\node_modules\async\waterfall.js:16:14)
at next (C:\Users\Raju\test-ipfs\node_modules\ipld-resolver\node_modules\async\waterfall.js:23:9)
at C:\Users\Raju\test-ipfs\node_modules\ipld-resolver\node_modules\async\internal\onlyOnce.js:12:16
at Object.serialize (C:\Users\Raju\test-ipfs\node_modules\ipld-dag-pb\src\util.js:34:3)
at waterfall (C:\Users\Raju\test-ipfs\node_modules\ipld-resolver\src\index.js:389:22)
at nextTask (C:\Users\Raju\test-ipfs\node_modules\ipld-resolver\node_modules\async\waterfall.js:16:14)
at exports.default (C:\Users\Raju\test-ipfs\node_modules\ipld-resolver\node_modules\async\waterfall.js:26:5)
at IPLDResolver._put (C:\Users\Raju\test-ipfs\node_modules\ipld-resolver\src\index.js:388:5)

@victorb
Copy link
Member

victorb commented Jan 27, 2018

@barnendu could you please post the code you used for getting this error?

@JonKrone
Copy link
Contributor

Hi @barnendu. This error might be caused because the local repo/storage that ipfs uses hasn't been initialized. Does running something like node src/cli/bin.js init help?

There is a similar issue that was just opened that finds this to be the problem and a fix that @paulogr might start working on. #1180

@barnendu
Copy link
Author

@JonKrone thanks, I have mistakenly called ipfs.files.add(data, [options], [callback]) API out side the node.on('ready', () => {}) event . Now the issue has been fixed by calling add file api inside the on ready event.

@pablohectorg
Copy link

pablohectorg commented Feb 1, 2018

I faced the same situation, in order for me to solve it i deleted a file called repo.lock located in .jsipfs folder at the home directory

@daviddias
Copy link
Member

@barnendu glad that you figured it out. Thanks for reporting anyway.

@daviddias daviddias added the kind/support A question or request for support label Feb 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/support A question or request for support
Projects
None yet
Development

No branches or pull requests

5 participants