Phoenix setup failing due to space in filepath - macos

I'm trying to set up the demo Phoenix project and I can't get past the step where I run mix ecto.create.
This is the error I get:
sh: /Volumes/1: No such file or directory
** (Mix) Could not compile dependency :fs, "/Volumes/1 TB HDD WD/Users/__USERNAME__/.mix/rebar compile skip_deps=true deps_dir="/Volumes/1 TB HDD WD/Users/__USERNAME__/.../hello_phoenix/_build/dev/lib"" command failed. You can recompile this dependency with "mix deps.compile fs", update it with "mix deps.update fs" or clean it with "mix deps.clean fs"
It really looks like it's because of the spaces in my hard drive name, but I'm not sure how to fix it.

Related

heroku build error: Treating warning as errors

Build error:
Treating warnings as errors because process.env.CI = true.
Most CI servers set it automatically.
My OS: Windows 10
The error msg is self explanatory.
Here is how I fixed it:
If you are using Windows OS, then first install the cross-env as a dev dependency.(https://github.com/kentcdodds/cross-env).
Then update your build command in package.json as follows:
Ex: For a project using Create React App;
"build": "cross-env CI=false react-scripts build"
Done!

Github Actions: No such file or Directory error

Background
I am trying to get a Github Action working with Windows and Bakeware because I am trying to create a release using it.
However, I am having an unexpected issue with creating folders.
Code
Following is a github action that is a Minimal Working Example of the issue.
Basically, all steps work, except for the creation of a single folder:
name: build
env:
MIX_ENV: test
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
name: Build on Windows
runs-on: windows-2019
env:
CC: gcc
MAKE: make
steps:
- uses: actions/checkout#v2
- uses: erlef/setup-beam#v1
with:
elixir-version: '1.13.x' # Define the elixir version [required]
otp-version: '24.2.x' # Define the OTP version [required]
- name: Install choco
shell: powershell
run: |
Set-ExecutionPolicy -ExecutionPolicy Bypass
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
- name: Install bakeware dependencies
shell: powershell
run: choco install -y zstandard make
- name: Install Dependencies
shell: powershell
run: mix deps.get
- name: Run credo code analyser
shell: powershell
run: mix credo --strict
I am even using powershell to do it (even though I am not really sure if this is needed).
Problem
However my GitHub Actions code comes back with this error:
==> bakeware
mkdir "d:/a/market_manager/market_manager/_build/test/lib/bakeware/obj"
mkdir "d:/a/market_manager/market_manager/_build/test/lib/bakeware/launcher"
mkdir "d:/a/market_manager/market_manager/_build/test/lib/bakeware/obj/zstd/lib/decompress"
mkdir: cannot create directory 'd:/a/market_manager/market_manager/_build/test/lib/bakeware/obj/zstd/lib/decompress': No such file or directory
make: *** [Makefile:70: d:/a/market_manager/market_manager/_build/test/lib/bakeware/obj/zstd/lib/decompress] Error 1
could not compile dependency :bakeware, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile bakeware", update it with "mix deps.update bakeware" or clean it with "mix deps.clean bakeware"
** (Mix) Could not compile with "make" (exit status: 2).
For the careful reader, you will notice the part saying:
mkdir: cannot create directory 'd:/a/market_manager/market_manager/_build/test/lib/bakeware/obj/zstd/lib/decompress': No such file or directory
Research
By changing the GitHub Action a little and adding an additional step, I was able to inspect some behaviour:
- name: Compile everything
shell: powershell
run: |
mkdir "d:/a/market_manager/market_manager/_build/test/lib/bakeware/obj"
mkdir "d:/a/market_manager/market_manager/_build/test/lib/bakeware/launcher"
mkdir "d:/a/market_manager/market_manager/_build/test/lib/bakeware/obj/zstd/lib/decompress"
ls .\_build\test\lib\bakeware\obj\zstd\lib\decompress
Test-Path -Path "d:/a/market_manager/market_manager/_build/test/lib/bakeware/obj/zstd/lib/decompress"
mix deps.compile --all
mix compile
env:
CC: C:\ProgramData\Chocolatey\bin\gcc.exe
MAKE: C:\ProgramData\Chocolatey\bin\make.exe
In this snippet I manually create the needed folders and then I assert on them. The output is as follows:
Directory: D:\a\market_manager\market_manager\_build\test\lib\bakeware
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2/2/2022 11:06 AM obj
d----- 2/2/2022 11:06 AM launcher
Directory: D:\a\market_manager\market_manager\_build\test\lib\bakeware\obj\zstd\lib
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2/2/2022 11:06 AM decompress
True
We can see that:
All directories are created
Test-Path returns True, which means that 'd:/a/market_manager/market_manager/_build/test/lib/bakeware/obj/zstd/lib/decompress' does exist.
This only makes things more confusing to me as the error has still not changed:
mkdir: cannot create directory 'd:/a/market_manager/market_manager/_build/test/lib/bakeware/obj/zstd/lib/decompress': No such file or directory
make: *** [Makefile:70: d:/a/market_manager/market_manager/_build/test/lib/bakeware/obj/zstd/lib/decompress] Error 1
could not compile dependency :bakeware, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile bakeware", update it with "mix deps.update bakeware" or clean it with "mix deps.clean bakeware"
** (Mix) Could not compile with "C:\ProgramData\Chocolatey\bin\make.exe" (exit status: 2).
I really can't understand the error No such file or directory when every command I used shows beyond reasonable doubt that the folder does exist.
Question
Why do I keep getting this error?
Answer
After smashing my head against a wall for several days, I think I finally figured it out.
The command was failing because of how cmd mkdir behaves, in that, it behaves different from the one in poewrshell.
By changing the Makefile to only create folders if they don't exist already, I was able to fix the issue while still mantaining backwards compatibility, which was one of my requirements.
I have submitted a PR with this fix and at the time of this writing, I am happy to announce it was already merged into master:
https://github.com/bake-bake-bake/bakeware/pull/128

When i run npm installl i get this errors and node_modules also disappears, wht can the cause be

I am following a course on udemy "codingwithmosh on Angular" and every time I download the zip file resources and run npm install I get this errors and node_modules will display and then disappears after this error
error snipit image

How to minify JS in laravel mix without add suffix .min.js?

I tried use minify method like below:
mix.minify('public/js/folder/script1.js');
mix.minify('public/js/folder/script2.js');
but it will create script1.min.js and script2.min.js
I also tried :
mix.minify('public/js/folder/script1.js', 'public/js/folder/script1.js');
mix.minify('public/js/folder/script2.js', 'public/js/folder/script2.js');
and still create same files. How to minify without add suffix .min.js?
I can't found laravel-mix solution, so I used another solution using uglifyjs-folder :
npm install uglifyjs-folder --save-dev
add && uglifyjs-folder public/js -e -x .js -o public/js to package.js inside prod script like below:
"scripts": {
"dev": "npm run development",
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"prod": "npm run production && uglifyjs-folder public/js -e -x .js -o public/js",
"production": "mix --production"
},
it will minify all .js files on public/js folder after running npm run prod.
Maybe it's not the best practice, but it worked for existing project that already bad practice;

Getting error Could not compile dependency :mimerl

(Mix) Could not compile dependency :mimerl, "/home/ubuntu/.mix/rebar3
bare compile --paths "/var/www/qserv/elixirbackend/_build/dev/lib/*/ebin""
command failed. You can recompile this dependency with "mix deps.compile mimerl",
update it with "mix deps.update mimerl" or clean it with "mix deps.clean mimerl"
I am getting this error on my server. Everything was working perfectly fine but after restarting my server, started facing the above mentioned issue.
Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:10] [hipe] [kernel-poll:false]
Elixir 1.6.3 (compiled with OTP 19)
I followed the instructions mentioned by Elixir forum user
ubuntu#ip-172-31-27-178:/var/www/qserv/elixir-backend$ sudo rm -rf /home/ubuntu/.mix/rebar3
ubuntu#ip-172-31-27-178:/var/www/qserv/elixir-backend$ mix local.rebar --force
and Then I also changed git permissions which I noticed while running mix phx.server
warning: unable to access ‘/home/ubuntu/.config/git/ignore’: Permission denied
warning: unable to access ‘/home/ubuntu/.config/git/attributes’: Permission denied
So, basically the problem was somehow I messed up permissions(I dont remember/know exactly how).
Credit goes to Norbert Melzer elixir forum user(Complete post).

Resources