How to make docker-compose volumes work on Hyper-V? - docker

I'm trying to run an application that uses volumes, but I get an error saying it couldn't find package.json.
10 error path /usr/src/app/package.json
11 error code ENOENT
12 error errno -2
13 error syscall open
14 error enoent ENOENT: no such file or directory, open '/usr/src/app/package.json'
14 error enoent This is most likely not a problem with npm itself
14 error enoent and is related to npm not being able to find a file.
15 verbose exit [ -2, true ]
What do I have to do so it find the files?
Currently using:
Windows 10 Pro
Docker 1.11.1-beta10 (build 2446)
Note: The same application works on docker for linux.

You have to allow docker to access your drivers. Go to:
Settings...
Manage shared drivers...
Select the driver where you want to create the volume
Enter your credentials

Related

SAFE Stack - installing pre-requisites

The SAFE Stack Documentation says to install npm (amongst other things) as a pre-requisite to build SAFE apps. But the link refers to https://www.npmjs.com where you have to search for packages. But which ones? What to install? There are thousands of packages there.
UPDATE:
I have just noticed that the npm documentation says that npm comes bundled with node, & most third-party distributions, by default. So why does the SAFE Stack documentation show the link to npm? Is there any sense in it?
I have tried to install the npm package via NuGet. But whatever I do, running the SAFE standard template in VS ends with a NullReferenceException:
File helpers.fs
let runOrDefault args =
try
match args with
| [| target |] -> Target.runOrDefault target
| _ -> Target.runOrDefault "Run" //NullReferenceException
0
with e ->
printfn "%A" e
1
Entering dotnet run through a command prompt opens a console window containing these messages:
Starting target 'InstallClient'
.> "C:\Program Files\nodejs\npm.CMD" install (In: false, Out: false, Err: false)
npm ERR! code EBADENGINE
npm ERR! engine Unsupported engine
npm ERR! engine Not compatible with your version of node/npm: undefined
npm ERR! notsup Not compatible with your version of node/npm: undefined
npm ERR! notsup Required: {"node":"~16","npm":"~8"}
npm ERR! notsup Actual: {"npm":"8.19.2","node":"v19.0.0"}
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Local\npm-cache\_logs\2022-11-04T11_38_04_408Z-debug-0.log
Finished (Failed) 'InstallClient' in 00:00:02.0540071
UPDATE:
In line with Tomáš Petříček's recommendation, I installed this version of node.js: Latest LTS Version: 18.12.0 (includes npm 8.19.2)
But again, NullReferenceException in VS, and the following error messages appear when using the command prompt:
Starting target 'InstallClient'
.> "C:\Program Files\nodejs\npm.CMD" install (In: false, Out: false, Err: false)
npm ERR! code EBADENGINE
npm ERR! engine Unsupported engine
npm ERR! engine Not compatible with your version of node/npm: undefined
npm ERR! notsup Not compatible with your version of node/npm: undefined
npm ERR! notsup Required: {"node":"~16","npm":"~8"}
npm ERR! notsup Actual: {"npm":"8.19.2","node":"v18.12.0"}
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Local\npm-cache\_logs\2022-11-04T13_19_03_959Z-debug-0.log
Finished (Failed) 'InstallClient' in 00:00:01.9942657
---------------------------------------------------------------------
Build Time Report
---------------------------------------------------------------------
Target Duration
------ --------
Clean 00:00:00.5118885
InstallClient 00:00:01.9937254 (Process exit code '1' <> 0. Command Line: C:\Program Files\nodejs\npm.CMD install)
Run 00:00:00 (skipped)
Total: 00:00:02.6111670
Status: Failure
---------------------------------------------------------------------
Fake.Core.BuildFailedException: Target 'InstallClient' failed.
I think all you need to install is Node.js from the official download page There are two versions:
LTS (stable) - version 18 and
Current (development) - version 19
I previously installed "Current" and then run into various troubles (though different ones than you are reporting). You also seem to have 19 according to the log. I gave up with Current and reverted my setup to the LTS version. So perhaps uninstalling the Node version you have right now and installing Node LTS may help.
These adaptations made it possible to run the SAFE standard template on my PC in line with the Quick Start guidelines:
Pre-requisites:
The .NET 6 SDK //OK
node.js (>= 8.0) //OK
npm //do not use this link
Azure CLI (optional - required for Azure deployments) //OK
Continue with guidlines 1 to 6 in the "Create your first SAFE app" section. Use cmd for the dotnet run command.
Look at the node and npm versions in this error message example:
npm ERR! notsup Actual: {"npm":"8.19.2","node":"v18.12.0"}
You may have different versions of npm and node, of course.
In line with this article by Adam Johnson, do this:
Open package.json in the root folder of the template and change the versions of npm and node accordingly, like this:
"private": true,
"engines": {
"node": "18.x",
"npm": "8.x"
}
To suppress warnings, you may add *.npmrc file containing the text string engine-strict=true next to the package.json file.
This answer, however, does not solve the problem why there is a link to npm in the pre-requisites section.
The solution in this answer looks somewhat complicated so if you have got a better idea, it will be fine if you publish it.
UPDATE 08-Nov-2022
Instructions telling you how to run/debug a SAFE Stack app in Visual Studio are here. Then no more problems with NullReferenceExceptions.

Packaged Electron app and launching a express app as a child process

Structure
Cloud
-solution
-app
-common
-index.js
When packaged, the app is in the asar file and i'm not sure how to reference the index.js file in the common folder where the server lives.
In development mode I exec a npm script that goes into the common folder and starts the server.
exec('cd ../ && cd common && npm run server', (err,stdout,stderr) => {
.....
if(err){
log.info(error.stack);
log.info('Error code: ' + error.code);}
}
I get this error in the exec callback when I try to run the script in production
Error: Command failed: npm run server-production
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\Ibrah\AppData\Local\Programs\Cloud\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\Ibrah\AppData\Local\Programs\Cloud\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
How can I reference the packaged app server file ?
I'm using both electron-forge and electron-builder to package and build the installer. What I did in my builder config was I included the extraResources key that makes available the specified folder(s) in the dist/{os}-unpacked/resources folder alongside the asar file.
electron-builder
"extraResources": [
{
"from": "../#cloud/common",
"to": "common"
}
],
Now when I exec the node script that is responsible for starting the server it points to the newly moved folder and which contains the script I'm executing. What's important is that I had to set the current working directory to
const runExpress = exec(' npm run server',{cwd:`../cloud/resources/common/`}, (error: any, stdout: any, stderr: any) => {
if (error) {
log.info(error.stack);
log.info('Error code: ' + error.code);
log.info('Signal received: ' + error.signal);
return;
}
else {
log.info('Child Process STDOUT: ' + stdout);
log.info('Child Process STDERR: ' + stderr);
}
});
My final remarks
Since I'm adding a folder to the accessible application directory User/AppData/Programs/YOUR_APPLICATION_NAME/ the source code becomes available to the user. Is that bad? or could I reference the script from inside the app.asar file (I was searching inside the app.asar for my server folder logic and found the package.json exist but without the scripts strangely enough). Would be great if someone can follow up to this.

npm install working in Travis CI but failng in GitHub Actions

We are migrating from Travis CI to GitHub Actions. In Travis CI, we have builds for node repositories.
Travis CI Configuration:
dist: trusty
language: node_js
node_js:
- 6.10.3
With this configuration, In Travis CI, npm install is working.
GitHub Actions Configuration:
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Setup Node.js environment
uses: actions/setup-node#v2.1.5
with:
node-version: '6.10.3'
- name: Check out repository code
uses: actions/checkout#v2.3.4
- name: script
run: |
npm install
But in GitHub Actions, I am getting below error
29484 verbose correctMkdir /github/home/.npm correctMkdir not in flight; initializing
129485 verbose afterAdd /github/home/.npm/bower/1.8.2/package/package.json written
129486 silly rollbackFailedOptional Starting
129487 silly rollbackFailedOptional Finishing
129488 silly runTopLevelLifecycles Finishing
129489 silly install printInstalled
129490 verbose stack Error: ENOENT: no such file or directory, open '/tmp/npm-604-fb46bda8/registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz'
129490 verbose stack at Error (native)
129491 verbose cwd /__w/website/website
129492 error Linux 5.4.0-1047-azure
129493 error argv "/__t/node/6.10.3/x64/bin/node" "/__t/node/6.10.3/x64/bin/npm" "i"
129494 error node v6.10.3
129495 error npm v3.10.10
129496 error path /tmp/npm-604-fb46bda8/registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz
129497 error code ENOENT
129498 error errno -2
129499 error syscall open
129500 error enoent ENOENT: no such file or directory, open '/tmp/npm-604-fb46bda8/registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz'
129501 error enoent ENOENT: no such file or directory, open '/tmp/npm-604-fb46bda8/registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz'
129501 error enoent This is most likely not a problem with npm itself
129501 error enoent and is related to npm not being able to find a file.
129502 verbose exit [ -2, true ]
I have tried below steps, but with no luck.
npm cache clean -f
rm node_modules package-lock.json
So far I am thinking of OS difference between two CIs. Travis being Ubuntu 14.04 and GitHub Actions being Ubuntu 20.04 (I also tried with 18.04)
Anyone has faced similar issues? Any ideas for work-around?
If any more information is required, do let me know!
Thanks!

electron-build fails with ERR_ELECTRON_BUILDER_CANNOT_EXECUTE

goal
I want to build an electron app ON a windows Machine for a Rasperry PI 4 running Raspbian32
configuration
"linux": {
"target" : [
{
"target": "AppImage",
"arch": ["armv7l"]
}
]
},
calling
"build-dist-lin": "webpack --mode production && electron-builder -l --config .env.json",
returned ERROR
cannot get, wait error=Get
"https://service.electron.build/find-build-agent?no-cache=1ghlrte":
dial tcp 51.15.76.176:443: connectex: A connection attempt failed
because the connected party did not properly respond after a period of
time, or established connection failed because connected host has
failed to respond.
attempt=0
waitTime=2
Error: C:\A\Repo\test\node_modules\app-builder-bin\win\x64\app-builder.exe exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
No Leads
There is no further information in this log to know where then ... it goes wrong. In the same env.json I also have a Windows Configuration part which runs perfectly well with calling it with -w. So that means that the configuration is probably ok. And that means it fails somewhere else.
full log:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\A\\Tools\\nodejs\\node.exe',
1 verbose cli 'C:\\A\\Tools\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build-dist-lin'
1 verbose cli ]
2 info using npm#6.13.4
3 info using node#v12.16.1
4 verbose run-script [ 'prebuild-dist-lin', 'build-dist-lin', 'postbuild-dist-lin' ]
5 info lifecycle testingtest#0.0.39~prebuild-dist-lin: testingtest#0.0.39
6 info lifecycle testingtest#0.0.39~build-dist-lin: testingtest#0.0.39
7 verbose lifecycle testingtest#0.0.39~build-dist-lin: unsafe-perm in lifecycle true
8 verbose lifecycle testingtest#0.0.39~build-dist-lin: PATH: C:\A\Tools\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\A\Repo\testingtestplayer\node_modules\.bin;C:\Python27\;C:\Python27\Scripts;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\WINDOWS\System32\OpenSSH\;C:\a\tools\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\dotnet\;C:\a\tools\Git\cmd;C:\Users\edward.deleau\AppData\Local\Microsoft\WindowsApps;C:\a\tools\Microsoft VS Code\bin;C:\Users\edward.deleau\AppData\Roaming\npm;C:\Users\edward.deleau\.dotnet\tools;C:\Users\edward.deleau\.dotnet\tools
9 verbose lifecycle testingtest#0.0.39~build-dist-lin: CWD: C:\A\Repo\testingtestplayer
10 silly lifecycle testingtest#0.0.39~build-dist-lin: Args: [
10 silly lifecycle '/d /s /c',
10 silly lifecycle 'webpack --mode production && electron-builder -l --config .env.json'
10 silly lifecycle ]
11 silly lifecycle testingtest#0.0.39~build-dist-lin: Returned: code: 1 signal: null
12 info lifecycle testingtest#0.0.39~build-dist-lin: Failed to exec build-dist-lin script
13 verbose stack Error: testingtest#0.0.39 build-dist-lin: `webpack --mode production && electron-builder -l --config .env.json`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\A\Tools\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:311:20)
13 verbose stack at ChildProcess.<anonymous> (C:\A\Tools\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:311:20)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid testingtest#0.0.39
15 verbose cwd C:\A\Repo\testingtestplayer
16 verbose Windows_NT 10.0.18362
17 verbose argv "C:\\A\\Tools\\nodejs\\node.exe" "C:\\A\\Tools\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build-dist-lin"
18 verbose node v12.16.1
19 verbose npm v6.13.4
20 error code ELIFECYCLE
21 error errno 1
22 error testingtest#0.0.39 build-dist-lin: `webpack --mode production && electron-builder -l --config .env.json`
22 error Exit status 1
23 error Failed at the testingtest#0.0.39 build-dist-lin script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Seems to be an issue with the electron builder. Since the free service host associated with the electron builder is unavailable and there by it refuses the connection. You could monitor the issue thread from the below link. This issue has been watched along for a long time I believe.
https://github.com/electron-userland/electron-builder/issues/3569
Unfortunately it doesn't seem that such issue will be fixed anytime soon, as we can see from the amount of (mostly open) GitHub issues that have been opened from users that are trying to deal with such problem in the past months:
service.electron.build is unavailable
Error: Cannot get, wait error=Get https://service.electron.build/find-build-agent
service.electron.build is unavailable - Urgently please suggest an alternate
Local build service not detected
Unable to build AppImage on Windows - service.electron.build
Connection to remote builder refused, while building linux package
That said, I used the following workarond using Docker that made me able to build a Linux redistributable .deb package for my Electron App from Windows 10 in less than 5 minutes:
Install Docker (link)
Download the electronuserland/builder Docker image with the following console command:
docker pull electronuserland/builder
From the Electron project's root folder (such as C:\MyApp), type the following command-line command to run the container and map the Electron project's root folder to the /project virtual path:
docker run -rm -ti -v C:\MyApp\:/project -w /project electronuserland/builder
From inside the container, type the following commands to upgrade the Electron project's Yarn packages, globally install the electron-builder package and build the Linux redistributable package:
cd /project
yarn upgrade
yarn global add electron-builder
electron-builder -l
If everything went smooth, you should be able to locate your MyApp.deb file (or rpm, AppImage, or anything you've configured within the electron-builder's package.json file) inside the Electron project's /dist/ folder.
For further info about this whole procedure and a bit of background, check out this post on my blog.

Ionic - app hangs on splash screen

My ionic app is hanging on the splash screen - it was working fine and then I added some code, and went to test, and it's getting stuck.
It gets to this point:
------ Debug phase ------
Starting debug of 2e5ac6066864be48322a757c4d0ccdfde52cf356 (N51AP, iPhone 5s (GSM), iphoneos, arm64) a.k.a. 'Eamon White’s iPhone' connected through USB...
[ 0%] Looking up developer disk image
[ 90%] Mounting developer disk image
[ 95%] Developer disk image already mounted
[100%] Connecting to remote debug server
-------------------------
(lldb) command source -s 0 '/tmp/2F06F4BB-A7E5-4B97-87EC-A01CBEE5661A/fruitstrap-lldb-prep-cmds-2e5ac6066864be48322a757c4d0ccdfde52cf356'
Executing commands in '/tmp/2F06F4BB-A7E5-4B97-87EC-A01CBEE5661A/fruitstrap-lldb-prep-cmds-2e5ac6066864be48322a757c4d0ccdfde52cf356'.
(lldb) platform select remote-ios --sysroot '/Users/eamonwhite/Library/Developer/Xcode/iOS DeviceSupport/10.3.3 (14G60)/Symbols'
Platform: remote-ios
Connected: no
SDK Path: "/Users/eamonwhite/Library/Developer/Xcode/iOS DeviceSupport/10.3.3 (14G60)/Symbols"
(lldb) target create "/Users/eamonwhite/ionicmane/myapp/platforms/ios/build/device/myApp.app"
Current executable set to '/Users/eamonwhite/ionicmane/myapp/platforms/ios/build/device/myApp.app' (arm64).
(lldb) script fruitstrap_device_app="/private/var/containers/Bundle/Application/5EBCC0EF-FDB9-4DE7-A961-D91B6139AEA0/myApp.app"
(lldb) script fruitstrap_connect_url="connect://127.0.0.1:50188"
(lldb) target modules search-paths add /usr "/Users/eamonwhite/Library/Developer/Xcode/iOS DeviceSupport/10.3.3 (14G60)/Symbols/usr" /System "/Users/eamonwhite/Library/Developer/Xcode/iOS DeviceSupport/10.3.3 (14G60)/Symbols/System" "/private/var/containers/Bundle/Application/5EBCC0EF-FDB9-4DE7-A961-D91B6139AEA0" "/Users/eamonwhite/ionicmane/myapp/platforms/ios/build/device" "/var/containers/Bundle/Application/5EBCC0EF-FDB9-4DE7-A961-D91B6139AEA0" "/Users/eamonwhite/ionicmane/myapp/platforms/ios/build/device" /Developer "/Users/eamonwhite/Library/Developer/Xcode/iOS DeviceSupport/10.3.3 (14G60)/Symbols/Developer"
(lldb) command script import "/tmp/2F06F4BB-A7E5-4B97-87EC-A01CBEE5661A/fruitstrap_2e5ac6066864be48322a757c4d0ccdfde52cf356.py"
(lldb) command script add -f fruitstrap_2e5ac6066864be48322a757c4d0ccdfde52cf356.connect_command connect
(lldb) command script add -s asynchronous -f fruitstrap_2e5ac6066864be48322a757c4d0ccdfde52cf356.run_command run
(lldb) command script add -s asynchronous -f fruitstrap_2e5ac6066864be48322a757c4d0ccdfde52cf356.autoexit_command autoexit
(lldb) command script add -s asynchronous -f fruitstrap_2e5ac6066864be48322a757c4d0ccdfde52cf356.safequit_command safequit
(lldb) connect
(lldb) run
success
(lldb) safequit
Process 7681 detached
The deviceready message never comes.
One thing I did that is kind of relevant is, when I was building or something ionic asked me to upgrade ios-deploy from 1.9.1 to 1.9.2. I think this started happening after I did that. I try to revert back to 1.9.1 but it won't let me:
ld: framework not found MobileDevice
clang: error: linker command failed with exit code 1 (use -v to see invocation)
** BUILD FAILED **
The following build commands failed:
Ld build/Release/ios-deploy normal x86_64
(1 failure)
npm ERR! Darwin 17.0.0
npm ERR! argv "/usr/local/Cellar/node/7.7.3/bin/node" "/usr/local/bin/npm" "install" "-g" "ios-deploy#1.9.1"
npm ERR! node v7.7.3
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! ios-deploy#1.9.1 preinstall: `./src/scripts/check_reqs.js && xcodebuild`
npm ERR! Exit status 65
npm ERR!
npm ERR! Failed at the ios-deploy#1.9.1 preinstall script './src/scripts/check_reqs.js && xcodebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ios-deploy package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ./src/scripts/check_reqs.js && xcodebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ios-deploy
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls ios-deploy
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/eamonwhite/Downloads/ionicmane-master/npm-debug.log
That might not be the problem. I could really use some help I'm close to a deadline.
UPDATE
When I try to run in xcode the same thing happens, but xcode gives these errors:
2017-10-10 15:49:17.417901-0400 myApp[8476:3520766] Resetting plugins due to page load.
2017-10-10 15:49:38.433127-0400 myApp[8476:3520766] Failed to load webpage with error: The request timed out.
UPDATE
I figured out what was causing this - it's livereload - if I run it without that its fine...but I kind of need it to work to develop.
I didn't have my wifi enabled on my phone so it couldn't connect to ionic.
From my experience we have the same issue deviceready is never shown in our console log, the most possible case would be inconsistency of the Cordova Plugin one thing that you could do is to reinstall the plugins and try to delete your platform folder and make a clean build with npm cache clean .
Update:
Based on your update , how are you running your ios app ?
Are you running your app using the -l -c commands like below:
ionic run ios -l -c
if that is the case you may be noticed that this command changes a line in the config.xml file:
// from
<content src="index.html"/>
// to
<content src="localhost//192.1.168.0:8000" original-src="index.html"/>
So Changing it back to <content src="index.html"/> might fixes the issue.
Solution 2:
You probably need to whitelist the localhost in the following way:
<allow-navigation href="http://localhost:8100/*"/>
My best guess is that your iPhone did not yet prepare the debugger for iOS11. It does so when running your app the first time on an new iOS version. You have to open and run your project once using XCode then you should be fine. Please also make sure you have the most recent version of cordova-ios which is 4.5.1 (check the <engine name=ios"> tag in your config.xml).
Check whether you have the following tag in your config.xml
<allow-navigation href="*"/>
Also can you check whether this is observed only in iOS or also in Android.
Ran into this with Ionic 4. After adding iOS platform, running the following worked:
ionic cordova prepare ios

Resources