Closed VanThanh1812 closed 6 years ago
@VanThanh1812 Could you run ls -A
at your console prompt and see if the directory you're unboxing in has any contents? If so the unbox command won't work because it doesn't want to risk overwriting anything. You should be able to create a new directory, navigate to it and then unbox. For example
mkdir VanToken
cd VanToken
truffle init
If this doesn't work please report back.
Oh, thank you, that's work, I did follow tut in medium then run npm init first. I think that is the cause of my problem :))
i got the same error. i first ran npm init -y and then i ran truffle init, so i have package.json in my folder. should i create a new folder inside of this folder to run truffle init successfully?
@cgewecke running ls -A shows the package.json file
@DeepakSuryaS Hi, unbox
only works in an empty folder to prevent any possibility of a box overwriting existing folder contents. The best thing to do is unbox first and npm init second.
@cgewecke ok, thanks!
:) it doesn't work if there is a hidden .git folder. is it really properly?
@ImmuneGitPlease unbox in an empty folder.
You must run this command in empty folder without any file.
yes, I see that it works for empty folder. But it’s not always logical. For example, I’ve clone a new empty project from git where I want to init truffle project. In that case it doesn’t work and I have to do it in another empty folder and then copy all files and folders to my project folder.
If you install truffle local to the application (e.g. yarn add truffle
), and try to use it (e.g. ./node_modules/bin/truffle init
), this error prevents you.
Same happened and this solution does help me! Thanks The tut I followed:https://medium.com/@merunasgrincalaitis/the-ultimate-end-to-end-tutorial-to-create-and-deploy-a-fully-descentralized-dapp-in-ethereum-18f0cf6d7e0e
I have the same issue on OSX. But NOTE: I deleted all the files from the current folder and now it is empty. I've also enabled showing of hidden files - the folder is really empty. I also tried to recreate this folder - the same result Just WTF?
$ truffle init
Downloading...
Error: Something already exists at the destination. Please unbox in an empty folder. Stopping to prevent overwriting data.
at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-box/lib/utils/unbox.js:22:1
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:118:7)
at Function.Module.runMain (module.js:692:11)
at startup (bootstrap_node.js:194:16)
at bootstrap_node.js:666:3
and of course hasn't truffle "uninstall" option?
Found out - OSX created "superhidden" file ".DS_Store" which is not shown in Finder and usual terminal command "ls" without params. I saw it with ls -A
only.
But it is a system file and why truffle doesn't allow to call init in this folder? It is a bug.
I also just ran into this problem, when I first setup a new project in WebStorm and then wanted to do a truffle init. The .idea folder from WebStorm was getting in the way. Would be awesome if this behavior would be changed.
it should promt something like "do you really want to install in this folder? Existing files will be overwritten". But now it just refuses such folders at all
Run this:
mkdir mydapp
cd mydapp
truffle init
Of course, you'll likely want to name your directory something other than mydapp
Next, you can run npm init
and the rest of your commands.
The problem is that truffle init must be run in directory that no files in it.
It's an annoying limitation - if it's going to be so picky, it should check if it in fact would override any of the existing files, like .git directory, or existing npm files. I guess this wasn't in older versions because I am following a tutorial and running into this issue, and the guy on youtube clearly didn't have problems.
Re-opening since this irritates so many people - but going to give some background as well so there's room for discussion about the best approach. Before we made unbox
(which is the parent command of init
) so strict, there was an issue like this one where the complaint was: unbox
deleted my files!! The underlying problem is the following:
truffle init
or truffle unbox
in one of their existing directories and think "phew! it didn't unbox" even though that directory doesn't contain anything in the box are under-represented in this thread. @cgewecke Thanks for these insights. I think you are right, that the people who did not get their files deleted through this are underrepresented.
Could truffle init
just check if these files/folders exist and if not just go ahead?
@Cryt1c Yes - agree - I think that's a good idea.
This same problem exists on my computer with a blank, uninitialized directory
2blockchains:gradient-token-tutorial leeazzarello$ truffle init
Downloading...
Error: Something already exists at the destination. Please unbox in an empty folder. Stopping to prevent overwriting data.
at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-box/lib/utils/unbox.js:22:1
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
at startup (internal/bootstrap/node.js:236:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:560:3)
2blockchains:gradient-token-tutorial leeazzarello$ ls -la
total 8
drwxr-xr-x 3 leeazzarello staff 96 Aug 19 15:37 .
drwxr-xr-x 44 leeazzarello staff 1408 Aug 19 15:37 ..
-rw-r--r-- 1 leeazzarello staff 175 Aug 19 15:37 package.json
2blockchains:gradient-token-tutorial leeazzarello$ truffle version
Truffle v4.1.7 (core: 4.1.7)
Solidity v0.4.23 (solc-js)
2blockchains:gradient-token-tutorial leeazzarello$ which truffle
/usr/local/bin/truffle
Truffle 5 now allows you to unbox/init in a non-empty folder. If there are name conflicts, it now prompts you to see if you want to overwrite the conflicting files. There is also a --force
option for both init and unbox which forces the unbox/init without the prompt. Closing this issue.
In mac os we use unbox or init for unboxing or initialization . But in Windows command prompt which command we have to use for unboxing or initialization?
Truffle 5 now allows you to unbox/init in a non-empty folder. If there are name conflicts, it now prompts you to see if you want to overwrite the conflicting files. There is also a
--force
option for both init and unbox which forces the unbox/init without the prompt. Closing this issue.
It would be better if this feature was added to v4 too. I ended up in this situation:
npx truffle init
to use the local version v4Error: Something already exists at the destination. Please unbox in an empty folder
Hello Everyone! i am very new to all these and i'm trying to unbox metacoin with Truffle. so this is what is happening: C:\Users\Giannis\Metacoin>truffle unbox Metacoin node:internal/modules/cjs/loader:936 throw err; ^
Error: Cannot find module 'C:\Users\Giannis\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js' ←[90m at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)←[39m ←[90m at Function.Module._load (node:internal/modules/cjs/loader:778:27)←[39m ←[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)←[39m ←[90m at node:internal/main/run_main_module:17:47←[39m { code: ←[32m'MODULE_NOT_FOUND'←[39m, requireStack: [] Any help please...?
Hi I have problem when run truffle init. Error: Something already exists at the destination. Please unbox in an empty folder. Stopping to prevent overwriting data. at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-box/lib/utils/unbox.js:22:1 at process._tickCallback (internal/process/next_tick.js:109:7) at Module.runMain (module.js:607:11) at run (bootstrap_node.js:423:7) at startup (bootstrap_node.js:147:9) at bootstrap_node.js:538:3 Any one help me, pls. Thanks.