I am using Embark version 2.1 .I have used the command 'embark ipfs' but it returns the following error.

(function (exports, require, module, __filename, __dirname) { var  Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var  moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x) {process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process["stderr"].write(x+"\n")};var nodeFS=require("fs");var nodePath=require("path");Module["read"]=function read(filename,binary){filename=nodePath["normalize"](filename);var ret=

ReferenceError: build_dir is not defined
at IPFS.deploy (/home/toshiba/.nvm/versions/node/v6.9.1/lib/node_modules/embark/lib/ipfs.js:16:37)
at Object.ipfs (/home/toshiba/.nvm/versions/node/v6.9.1/lib/node_modules/embark/lib/index.js:265:10)
at Command.<anonymous> (/home/toshiba/.nvm/versions/node/v6.9.1/lib/node_modules/embark/lib/cmd.js:136:17)
at Command.listener (/home/toshiba/.nvm/versions/node/v6.9.1/lib/node_modules/embark/node_modules/commander/index.js:301:8)
at emitTwo (events.js:106:13)
at Command.emit (events.js:191:7)
at Command.parseArgs (/home/toshiba/.nvm/versions/node/v6.9.1/lib/node_modules/embark/node_modules/commander/index.js:615:12)
at Command.parse (/home/toshiba/.nvm/versions/node/v6.9.1/lib/node_modules/embark/node_modules/commander/index.js:458:21)
at Cmd.process (/home/toshiba/.nvm/versions/node/v6.9.1/lib/node_modules/embark/lib/cmd.js:19:11)
at Object.process (/home/toshiba/.nvm/versions/node/v6.9.1/lib/node_modules/embark/lib/index.js:31:9)

How can i solve this issue?

2 Answers 2


This has been fixed in 2.2.0, please update to 2.2.0 and use the new command embark upload ipfs. you'll need to have a ipfs node running.

  • @ iurimatias I have tried to update but it generates the following error while using embark commands /home/toshiba/.nvm/versions/node/v6.9.1/lib/node_modules/embark/node_modules/web3/lib/web3/httpprovider.js:37 XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; // jshint ignore: line ^ ReferenceError: XMLHttpRequest is not defined Jan 13, 2017 at 4:17
  • That's an ongoing issue with web3.js which is affecting all tools & frameworks dependant on it: github.com/ethereum/web3.js/issues/548 it should be fixed soon, once it does you can reinstall embark and it should work again
    – iurimatias
    Jan 13, 2017 at 11:50
  • it's been fixed (github.com/ethereum/web3.js/releases/tag/0.18.2) please try again or try updating with npm install -g [email protected]
    – iurimatias
    Jan 13, 2017 at 12:49
  • I have updated embark successfully. Jan 16, 2017 at 4:10

This issue is related to Embark and not Ethereum.

The source of the error is this line from ipfs.js:

var cmd = ipfs_bin + " add -r " + build_dir;

Make sure you follow Installation & EmbarkJS

The documentation specifies:

To deploy a dapp to IPFS, all you need to do is run a local IPFS node and then run embark ipfs. If you want to deploy to the livenet then after configuring you account on config/blockchain.json on the production environment then you can deploy to that chain by specifying the environment embark ipfs production.

I assume you did not run a local node first. To run a local IPFS node read IPFS: Getting Started

To run on livenet, configure blockchain.json, then run embark ipfs production

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.