running npx update with error cannot find set-blocking - android

I tried using "npx update". I am at a total loss why i am getting this error and cannot seem to find even a starting point on this. The only thing I am using npx for is capacitor (with ionic framework). Any help on the reason for this or fixes or just being pointed in the right directions would help
C:\dev\p\bas>npx update
npx: installed 658 in 28.218s
[23:34:41] using file ~C:\Users\Hunter\AppData\Roaming\npm-cache\_npx\6000\node_modules\update\lib\updatefile.js
[23:34:41] starting update.default
[23:34:41] √ running: init
Current updaters: init
no updaters were saved.
[23:34:42] finished update.default √ 410ms
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'set-blocking'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at process.<anonymous> (C:\Users\Hunter\AppData\Roaming\npm-cache\_npx\6000\node_modules\update\bin\update.js:4:3)
at process.emit (events.js:203:15)
at process.exit (internal/process/per_thread.js:168:15)
at C:\Users\Hunter\AppData\Roaming\npm-cache\_npx\6000\node_modules\update\bin\update.js:55:15
at C:\Users\Hunter\AppData\Roaming\npm-cache\_npx\6000\node_modules\update\node_modules\base-generators\index.js:482:13
at C:\Users\Hunter\AppData\Roaming\npm-cache\_npx\6000\node_modules\update\node_modules\async-each-series\index.js:15:40

What helped resolve the error for me was updating my npm version first:
npm install -g npm#latest
npm install -g set-blocking
npx update

Just run the npm command to install the missing module:
npm install set-blocking
and then run npx update again
Hope it helps! :)

Related

TypeError: cli.init is not a function when npx react-native init

After upgrading React Native from 0.68.2 to 0.70.1 on MacOS Monterrey M1, npx react-native init my-prom started throwing error:
/opt/homebrew/lib/node_modules/react-native-cli/index.js:302
cli.init(root, projectName);
^
TypeError: cli.init is not a function
at run (/opt/homebrew/lib/node_modules/react-native-cli/index.js:302:7)
at createProject (/opt/homebrew/lib/node_modules/react-native-cli/index.js:249:3)
at init (/opt/homebrew/lib/node_modules/react-native-cli/index.js:200:5)
at Object.<anonymous> (/opt/homebrew/lib/node_modules/react-native-cli/index.js:153:7)
at Module._compile (node:internal/modules/cjs/loader:1120:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1174:10)
at Module.load (node:internal/modules/cjs/loader:998:32)
at Module._load (node:internal/modules/cjs/loader:839:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47
Node.js v18.7.0
npm -g list shows react-native-cli 2.0.1 was installed globally. Remove react-native-cli and install it again global didn't fix the problem. React Native was installed locally.
yarn add react-native --exact
This should be able to fix your problem, don't know exactly why though!

error while trying to add android platform with ionic

When running the command ionic cordova add platform android I am getting the following error.
I've completely uninstalled Nodejs and reinstalled Ionic and Cordova globally from scratch but I can not figure out why this error is occurring.
The error also occurs when I execute the command cordova -v
cordova.cmd platform add android --save
C:\Users\LUIZ\AppData\Roaming\npm\node_modules\cordova\node_modules\execa\index.js:347
throw err;
^
Error: Command failed: wmic os get Caption
Description = O servi�o n�o pode ser iniciado porque est� desativado ou n�o tem dispositivos ativados associados.
at makeError (C:\Users\LUIZ\AppData\Roaming\npm\node_modules\cordova\node_modules\execa\index.js:174:9)
at Function.module.exports.sync (C:\Users\LUIZ\AppData\Roaming\npm\node_modules\cordova\node_modules\execa\index.js:338:15)
at windowsRelease (C:\Users\LUIZ\AppData\Roaming\npm\node_modules\cordova\node_modules\windows-release\index.js:34:24)
at osName (C:\Users\LUIZ\AppData\Roaming\npm\node_modules\cordova\node_modules\os-name\index.js:39:18)
at new Insight (C:\Users\LUIZ\AppData\Roaming\npm\node_modules\cordova\node_modules\insight\lib\index.js:37:13)
at Object.<anonymous> (C:\Users\LUIZ\AppData\Roaming\npm\node_modules\cordova\src\telemetry.js:26:15)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd platform add android --save exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
This error occurs every time I run the command, I can not add the Android platform. I need to run ionic cordova run android to open in my emulator I created in Android Studio.
npm list -g --depth=0
C:\Users\LUIZ\AppData\Roaming\npm
+-- #angular/cli#8.0.2
+-- cordova#9.0.0
`-- ionic#5.0.1
I tried many things, but I had to:
Windows-Key (Keyboard)
System Environment Variable
Environmentsvariables..
Select Path Variable and edit
Add the path to your wbem
example: c:\Windows\System32\wbem
Restart cmd
Enjoy

Cannot Find entry file index.ios.js in any of the project roots ["/Users/neo/newProjects/F2"]

Actual Behavior
Instead of launching, I get a red screen and this error message when launching a react native projects from scratch: Cannot Find entry file index.ios.js in any of the project roots ["/Users/neo/newProjects/F2"]
Expected behavior
Launch of a clean app starter
What I am trying to do
I'm trying to init and run a react-native project from scratch in the android and ios simulator, but I'm getting the following error.
What I have tried
I've tried doing the following:
Install via documentation
Moving through the install steps outlined here several times:
https://facebook.github.io/react-native/docs/getting-started.html
NPM Install
Performing NPM Install from within the project folder
Editing .profiles ( android )
editing the ~.profiles file, to set the android home variable.. this is what it looks like now:
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" $
export ANDROID_HOME=${HOME}/Library/Android/sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools`
Npm start
Running npm start and checking activity on the port, ( was the package manager running )
checking the port for activity
( forget how, verified its available )
Code that worked for someone...
I have also tried running this code in the terminal
react-native bundle \
--entry-file=index.ios.js \
--platform=ios \
--dev=false \
--assets-dest=./production/ios \
--bundle-output=./production/ios/ios.jsbundle
After reviewing this article https://github.com/facebook/react-native/issues/8664
And got this error message:
ENOENT: no such file or directory, open './production/ios/ios.jsbundle'
I noticed this suggestion
rerunning npm install and rnpm link
I tried running rnpm link, but got "no such command found"
after reading this article
Entry file error in react native from packager
In the same article I saw this:
"Figured out that after updating to RN 0.28 my app is spitting this issue due to incompatible dependencies. This is how I solved this problem"
rm -rf node_modules
npm cache clean
Then open package.json except react-native change all package versions to *
Then run
npm update --save
npm update --save-dev
Check package if package.json is updated with version numbers, if not verify from npmjs and update manually
Delete app from the device and try to run again
But I cannot discern what the advisor is doing here... and the logic behind it... if it seems relevant, can someone comment on this?
Terminal Output
I am getting this in the terminal:
Loading dependency graph, done.
error: bundling: Error
at DependencyGraph._getAbsolutePath
(/Users/neo/newProjects/F2/node_modules/react-native/packager/src/node-haste/index.js:272:11)
at DependencyGraph.getDependencies (/Users/neo/newProjects/F2/node_modules/react-native/packager/src/node-haste/index.js:216:26)
at Resolver.getDependencies (/Users/neo/newProjects/F2/node_modules/react-native/packager/src/Resolver/index.js:106:27)
at _resolverPromise.then.resolver (/Users/neo/newProjects/F2/node_modules/react-native/packager/src/Bundler/index.js:561:62)
at process._tickCallback (internal/process/next_tick.js:109:7)
Bundling `index.ios.js` 0.0% (0/1), failed.
Versions
Node v7.9.0
react-native-cli: 2.0.1
react-native: 0.44.0
Homebrew 1.2.0
Just updated xcode
OSX 10.11.6 (15G1004)
What I notice
I notice that it seems to be looking in this file.. ["/Users/neo/newProjects/F2"] whereas in some locations on my machine the files are organized Users/Neo/... ( capital username ) ... and I sense that has something to do with this.
also, on project build it does throw this warning... not sure what it means...
"react-native#0.44.0" has unmet peer dependency "react#16.0.0-alpha.6"
Any suggestions or ideas?
update
tried changing directories out of the users folder and initializing
here is what I got in the stacktrace
2017-05-02 09:25:21.478 xcodebuild[52491:5334564] Error saving log: Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={NSFilePath=/code/F4/ios/build/Logs/Build/B9E13558-CCE5-4451-AC21-7E643189BF7B.xcactivitylog, NSLocalizedDescription=No such file or directory} | User info: {
NSFilePath = "/code/F4/ios/build/Logs/Build/B9E13558-CCE5-4451-AC21-7E643189BF7B.xcactivitylog";
NSLocalizedDescription = "No such file or directory";
}
Installing build/Build/Products/Debug-iphonesimulator/F4.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/F4.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Also, tried installing expo and running from there...
Heres what the terminal shows
Error sourcing shell startup scripts: /Users/neo/.bash_profile: line 2: rbenv: command not found
/Users/neo/.bash_profile: line 4: rbenv: command not found
/Users/neo/.bash_profile: line 5: rbenv: command not found
/Users/neo/.bash_profile: line 7: rbenv: command not found
/Users/neo/.bash_profile: line 9: rbenv: command not found
/bin/bash: shell_session_update: command not found
.
Please run npm install -g exp && exp path``
10:25:22 AM
Starting React Native packager...
10:25:31 AM
Scanning 656 folders for symlinks in /code/my-new-project/node_modules (11ms)
10:25:32 AM
Loading dependency graph.
10:25:32 AM
Running packager on port 19001.
10:25:32 AM
10:25:37 AM
Dependency graph loaded.
10:25:51 AM
Project opened! You can now use the "Send Link" or "Device" buttons to view your project.
10:36:58 AM
Couldn't start project on Android: could not install *smartsocket* listener: Address already in use
ADB server didn't ACK
* failed to start daemon *
error: cannot connect to daemon
`

cordova android build failure: processArmv7DebugResources

I'm building a hybrid app with cordova. The setup has been tested with simple application. Both android and iOS build works fine.
After switching to a more complex application, the following error occurred. I googled and found some suggested solution but none of the worked.
I'm new to this so any suggestion appreciated.
:processArmv7DebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processArmv7DebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/Cellar/android-sdk/24.4.1_1/build-tools/23.0.2/aapt'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 28.659 secs
ERROR building one of the platforms: Error code 1 for command: /Users/wliang/work/hzoom/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/wliang/work/hzoom/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
You may not have the required environment or OS to build this project
Error: Error code 1 for command: /Users/wliang/work/hzoom/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/wliang/work/hzoom/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
In my case I discovered the error with the follow command:
cordova build android -- --gradleArg=--info
I have found:
Executing task ':processArmv7DebugResources' (up-to-date check took 0.009 secs) due to:
Input file /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/assets/armv7/debug/www/libs/long/dist/long.min.js.gz has been added.
Starting process 'command '/Users/astaniscia/Library/Android/sdk/build-tools/24.0.2/aapt''. Working directory: /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android Command: /Users/astaniscia/Library/Android/sdk/build-tools/24.0.2/aapt package -f --no-crunch -I /Users/astaniscia/Library/Android/sdk/platforms/android-23/android.jar -M /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/manifests/full/armv7/debug/AndroidManifest.xml -S /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/res/merged/armv7/debug -A /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/assets/armv7/debug -m -J /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/generated/source/r/armv7/debug -F /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/res/resources-armv7-debug.ap_ --debug-mode --custom-package com.navionics.poc -0 apk --output-text-symbols /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/symbols/armv7/debug --no-version-vectors
Successfully started process 'command '/Users/astaniscia/Library/Android/sdk/build-tools/24.0.2/aapt''
Unable to add '/Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/assets/armv7/debug/www/libs/long/dist/long.min.js.gz': file already in archive (try '-u'?)
ERROR: unable to process assets while packaging '/Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/res/resources-armv7-debug.ap_'
:processArmv7DebugResources FAILED
:processArmv7DebugResources (Thread[Daemon worker Thread 16,5,main]) completed. Took 0.312 secs.
and this line helped me
Unable to add '/Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/assets/armv7/debug/www/libs/long/dist/long.min.js.gz': file already in archive (try '-u'?)
for me solve the problem... I removed the gzip and now all work fine!
I had the same issue and this is what I found to be the issue.
The bower components folder - which normally defaults to www/lib/ using cordova - was the culprit in my case.
I had modified one of the bower components, to do that I had to first run npm install inside the specific package that I was updating. After doing that there was a node_modules folder inside the specific component I was updating i.e. www/lib/{name_of_component}/node_modules. Basically this specific node_modules folder is only used for build tools concerning the specific component, and thus it is not needed once you are done updating it and want to build the whole app. Some of the modules inside that specific component's node_modules may conflict with the projects node_modules i.e. {your_app}/node_modules - this can cause problems. In my case the conflict was with the semver module.
So in my case the solution was to delete that specific node_modules folder. After that I could build my app without any issues.
Hopefully this helps.
This is an old issue, but I recently came upon the same one and hope my experience might help someone else in the future.
After a solid day of looking around I realized it had to do with my plugins. For some reason there was an unused dependency in package.json that wouldn't allow it to build.
In my case, it was Firebase, and after removing it from package.json and the plugins folder I ran
cordova platform remove android
and
cordova platform add android
then built it again and all of a sudden it was up and running!
This error shows up because you have one or several accentuated filenames in your project folder. In my case, it was an image with the char "ç".
This topic can help rename automatically: https://superuser.com/questions/617517/remove-all-illegal-characters-from-all-filenames-in-a-given-folder
For me it was the node_modules folder inside www that caused the problem.
The solution is to copy your www to another folder and exclude node_modules and you will be fine.
The thing that worked for me :
cordova plugin add cordova-android-support-gradle-release
Thanks to lohith95
from https://forum.ionicframework.com/t/android-build-broken-after-gradle-dependencies-update-execution-failed-for-task-processdebugresources-com-android-ide-common-process-processexception-failed-to-execute-aapt/109982/170
This is might because you use crosswalk,
You can try the following commands:
sudo ionic cordova platform remove android 
sudo rm -rf ./node_modules
sudo npm install --unsafe-perm=true --allow-root
sudo npm install --unsafe-perm node-sass
sudo ionic cordova platform add android#6.4.0 
sudo ionic cordova plugin add cordova-android-support-gradle-release
sudo ionic cordova build android 

How to locally build an ionic app taken from a .git repository

I was trying to build Moodle's ionic mobile app locally on Windows by following the below steps:
cd project-directory
ionic platform add android
The command prompt returns the below error:
Updated the hooks directory to have execute permissions
Adding android project...
Running command: cmd "/s /c "C:\Users\zameer\.cordova\lib\npm_cache\cordova-andr
oid\4.1.1\package\bin\create.bat D:\ionic\moodlemobile2-master\moodlemobile2-mas
ter\platforms\android com.moodle.moodlemobile "Moodle Mobile" --cli""
Creating Cordova project for the Android platform:
Path: platforms\android
Package: com.moodle.moodlemobile
Name: Moodle Mobile
Activity: MainActivity
Android target: android-22
Copying template files...
Android project created with cordova-android#4.1.1
Running command: "C:\Program Files\nodejs\node.exe" D:\ionic\moodlemobile2-maste
r\moodlemobile2-master\hooks\after_prepare\010_add_platform_class.js D:\ionic\mo
odlemobile2-master\moodlemobile2-master
add to body class: platform-android
Running command: "C:\Program Files\nodejs\node.exe" D:\ionic\moodlemobile2-maste
r\moodlemobile2-master\hooks\after_prepare\020_add_ios_transport_security.js D:\
ionic\moodlemobile2-master\moodlemobile2-master
module.js:338
throw err;
^
Error: Cannot find module 'plist'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object. (D:\ionic\moodlemobile2-master\moodlemobile2-master\ho
oks\after_prepare\020_add_ios_transport_security.js:10:13)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
Error: Hook failed with error code 1: D:\ionic\moodlemobile2-master\moodlemobile
2-master\hooks\after_prepare\020_add_ios_transport_security.js
Everything seems normal till the below part of the above error block:
throw err;
^
Error: Cannot find module 'plist'
My aim is to run this project locally to see ionic in action
What is this plist module? Why is it not getting detected?
After cloning a Git repository that contains a Ionic app, you need to run these 2 additional commands:
Install Node.js dependencies
npm install
It will install all the Node.js dependencies in the local node_modules folder. The modules considered are the ones listed under dependencies and devDependencies in the package.json file located at the root of the cloned Git repository.
Install Cordova plugins
ionic state restore
This command looks at the cordovaPlugins and cordovaPlatforms attributes in the package.json file and install the additional platforms and plugins code required for the app.
You did not execute npm install so you are missing the required packages.
Read this on what need to be done to work with ionic.
Go into the project folder where the package.json is in and execute the npm install form that folder.

Categories

Resources