Closed codepandy closed 2 years ago
me too ,same problem
Hey @shch & @codepandy , can you provide full reproduction steps?
Which versions of Node, Truffle, & Solidity are you using while this error is happening? Does Truffle provide an error or does the process just hang?
Hey @shch & @codepandy , can you provide full reproduction steps?
Which versions of Node, Truffle, & Solidity are you using while this error is happening? Does Truffle provide an error or does the process just hang?
me too ,same problem ,just hang,No report error .
Truffle v5.1.2 (core: 5.1.2)
Solidity v0.5.12 (solc-js)
Node v13.2.0
Web3.js v1.2.2
Hey @shch @codepandy @CruzMolina
After a long wait, it can finally be executed. Guess what it's running in the background, and it's fast to execute now. It's so sad that there is no error.
me too . The same question
i-qcloud527:pet root# truffle compile
⠼ Fetching solc version list from solc-bin. Attempt #1
Hey @shch @codepandy @CruzMolina
After a long wait, it can finally be executed. Guess what it's running in the background, and it's fast to execute now. It's so sad that there is no error.
Do you slove it ? it need to download something or Bug ?
Hey everyone, is this still a problem for you? We'd like to know if we can do something about it if so, thanks y'all!
Seconded.
A POSSIBLE SOLUTION / HACK
NOTE: OSX 10.14.6
frustrating. it compiles using open zeppelin cli. installed locally, using npx truffle console
truffle(development)> version Truffle v5.1.32 (core: 5.1.32) Solidity - 0.6.2 (solc-js) Node v13.7.0 (also tried with v10.19.0 and v12.16.1) Web3.js v1.2.1
Compiling your contracts...
✔ Fetching solc version list from solc-bin. Attempt #1
✔ Downloading compiler. Attempt #1.
✔ Downloading compiler. Attempt #2.
✔ Downloading compiler. Attempt #3.
Error: Could not find a compiler version matching 0.6.2. Please ensure you are specifying a valid version, constraint or build in the truffle config. Run `truffle compile --list` to see available versions.
On using npx truffle obtain 0.6.2
✔ Downloading compiler. Attempt #3.
Unbox failed!
Note I can (and have) try to download and build 0.6.2, or find a binary. But determining how to install these manually is ambiguous.
BUT....
sudo npx truffle compile appears to solve the problem.
Compiling your contracts...
✔ Fetching solc version list from solc-bin. Attempt #1
✔ Downloading compiler. Attempt #3078
> Compiling contracts/p.sol
> Artifacts written to /Users/keny/Desktop/ERC20/p/build/contracts
> Compiled successfully using:
- solc: 0.6.2+commit.bacdbe57.Emscripten.clang
So I would say the solution has something to do with permissions when downloading the file but the error reporting is ambiguous as it does not say there was a permissions error.
ls -al /Users/keny/.config/truffle/compilers/node_modules
-rw-r--r-- 1 root staff 7985148 Jun 26 23:27 soljson-v0.6.2+commit.bacdbe57.js
ls -al /Users/keny/.config/truffle/compilers/
drwxr-xr-x 4 root staff 128 Jun 26 23:27 node_modules
Now it appears to work. My thought is that truffle (this didnt work on a global install either) is unable to write a downloaded file into its compilers directory because apple is running some sort of gatekeeper and the program is not asking for permission to install thing downloaded from the interwebs.
Finally, after running sudo it appears to subsequently work, because it no longer needs to download the compiler into the directory.
@snowkidind It works.
Question for the people experiencing this issue. When you installed Truffle, did you use sudo
or otherwise do it with root permissions? That may be the source of the problem. Thanks!
Local install, not global. sudo should not be required. But it's trying to install a compiler in a root - owned directory per my comment above.
I would say try using nvm or some other node version manager in this case. When you use nvm and npm it designates a different directory for installed packages which prevents permissions issues.
If anyone tries using nvm with npm to install and use Truffle can they let me know whether it resolves this problem?
Now that I understand the issue it's easy to resolve, but my notes point out that the error messages are pointing at the wrong error causing overall confusion. It looks like a failed download when it's a permissions error.
Sounds like there's more we can do here to make the experience more clear. Calling this one "error better" and getting it onto our backlog. Thanks for the investigation everyone, and sorry for the inconvenience!
Is there something actionable here? Just evaluating whether we can close this.
Seems like there's an action here to, upon error obtaining solc, detect the permissions of the compilers cache directory and, if the permissions are insufficient, suggest they rimraf the whole computer or something.
cc @cds-amal
Hi, I just wanted to post what worked for me. For quick context, I'm deploying a Web IDE on K8s Environment which does not have access to internet. I built a container image with all the files I needed, pakcage.json, node_modules, etc.. For including the soljson-v...
used by truffle I run when build the image
RUN npx truffle obtain --solc 0.8.3 && \
npx truffle obtain --solc 0.8.9 && \
npx truffle obtain --solc 0.8.11 && \
npx truffle obtain --solc 0.8.14
That command created the following folder /root/.config/truffle/compilers/node_modules/
and /root/.config/truffle-nodejs/compilers/node_modules/
so I had to create the same folder for the user I set to run the container using the following:
RUN mkdir -p /home/coder/.config/truffle/compilers/node_modules && \
mkdir -p /home/coder/.config/truffle-nodejs/compilers/node_modules && \
cp -R /root/.config/truffle/compilers/node_modules/* /home/coder/.config/truffle/compilers/node_modules/ && \
cp -R /root/.config/truffle-nodejs/compilers/node_modules/* /home/coder/.config/truffle-nodejs/compilers/node_modules/
RUN chown -R $UID:$UID /home/coder && \
chmod -R 777 /home/coder
Altogether the last lines of my Dockerfile looks like this
RUN npx truffle obtain --solc 0.8.3 && \
npx truffle obtain --solc 0.8.9 && \
npx truffle obtain --solc 0.8.11 && \
npx truffle obtain --solc 0.8.14
WORKDIR /home/coder/project
ENTRYPOINT ["dumb-init", "fixuid", "-q", "/usr/local/bin/code-server", "--host", "0.0.0.0", "--disable-updates", "--disable-telemetry", "/home/coder/project"]
USER root
RUN mkdir -p /home/coder/.config/truffle/compilers/node_modules && \
mkdir -p /home/coder/.config/truffle-nodejs/compilers/node_modules && \
cp -R /root/.config/truffle/compilers/node_modules/* /home/coder/.config/truffle/compilers/node_modules/ && \
cp -R /root/.config/truffle-nodejs/compilers/node_modules/* /home/coder/.config/truffle-nodejs/compilers/node_modules/
RUN chown -R $UID:$UID /home/coder && \
chmod -R 777 /home/coder
USER $UID
I hope this helps someone.
Hi @inglkruiz,
Just a tip in case you aren't aware, the .config
directory is being created under the /root
directory during your docker build, because the docker build defaults to running as root
within the temporary build containers that docker sets up when running docker build
.
Assuming that coder
is a known user inside of your docker image, you could likely switch to that user via the USER coder
directive prior to running the npx truffle obtain ...
commands.
If the coder
user is not known to your environment, you could add it by doing RUN useradd -Dm coder
, and then switch to it using the USER coder
directive.
If that still doesn't fix the issue, try wrapping your command in a bash login console, like so:
USER coder
RUN /usr/bin/env bash -lc 'for VERSION in 0.8.3 0.8.9 0.8.11 0.8.14 do; npx truffle obtain --solc $VERSION; done'
i changed the ownership of ~/.config/truffle-nodejs and it worked chown userName -R ~/.config/truffle-nodejs in my case the problem was that the file was locked to use only by root even though i never installed truffle using sudo
Closing for issue maintenance.
then