Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

Windows - Dapple Install/Dapple Init #361

Open
cswatson opened this issue Nov 12, 2016 · 4 comments
Open

Windows - Dapple Install/Dapple Init #361

cswatson opened this issue Nov 12, 2016 · 4 comments

Comments

@cswatson
Copy link

I'm following this tutorial: http://blog.nexusdev.us/dapple-tutorial/

First I had some trouble installing Dapple. I was able to figure it out - installing window-build-tools via npm and then installing the .Net sdk.

I still received an error stating: Failed at the secp256k1@3.2.2 rebuild script 'node-gyp rebuild'.
But the installation was completed otherwise.

Now when I run "dapple init" in my project directory, this follows:

-Secp256k1 bindings are not compiled. Pure JS implementation will be used.
-ERROR: ENOENT: no such file or directory, lstat 'C:\dapple-tutorial\Dappfile'

@dbrock
Copy link
Contributor

dbrock commented Nov 13, 2016

Do you have the ability to run Docker containers?

If so, you might want to try using the dapple-docker script, which functions as a drop-in replacement for dapple. This script works by mounting your file system into a Docker container such that you are able to pretend that you have the Solidity compiler and Dapple installed natively.

So you would do e.g. mkdir foo; cd foo; dapple-docker init; dapple-docker test, etc. If this seems to work for you, then you might want to install dapple-docker under the name dapple for your convenience.

I don't think this has been tested on Windows before, though, so please let me know if you have any problems.

@cswatson
Copy link
Author

cswatson commented Nov 13, 2016

Okay - so I had a little more time to dig in and do some problem solving.

I just did a fresh install of Dapple (via npm) and I actually had a clean install this time. No errors at all, it worked perfectly.

I still had the -ERROR: ENOENT: no such file or directory, lstat 'C:\dapple-tutorial\Dappfile' error occurring, but I dug into the source code this time.

The problem is in "./lib/workspace.js", specifically at line 77:

if (fs.existsSync(dappfilePath)) {
      throw new Error('dappfile already exists');
    }

From what I gather, fs.existsSync(dappfilePath) is looking for dappfilePath and crashes when it finds that it doesn't exist, instead of making the directory. I deleted this if statement and ran dapple init once more and .dapple, build, src and DappFile were all installed in my target directory.

I put the if statement back in the code, ran it again and received the "dapp file already exists code", as intended.

I'll try to debug this a little more and get it to work properly with the if statement. But that was the necessary work, as of now.

Cheers.

*I'm still trying to figure it out. But the problem is definitely that instead of returning "false" when fs.existsSync()can't find the file, it returns an error.

@OnlyOneJMJQ
Copy link

OnlyOneJMJQ commented Jan 8, 2017

Commenting out the same lines @cswatson did also worked for me.

@ghost
Copy link

ghost commented Feb 18, 2017

It's because of the way fs.existsSync() works. If the passed file doesn't exist, it simply throws an error. All you need to do is wrap the code in a try-catch block and you've a fix.

var dappfilePath = path.join(root_dir, constants.DAPPFILE_FILENAME);
try{
	if (fs.existsSync(dappfilePath)) {
	  throw new Error('dappfile already exists');
	}
}catch(err){
	console.log('Dappfile doesn\'t exist. Creating..');
}`

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants