segunda-feira, 13 de março de 2017

npm install npm ERR! Error: EPERM: operation not permitted, rename

Opa :)

Ao dar um npm install tive o seguinte erro:

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\work\\Dropbox\\othertools\\node\\node.exe" "C:\\Users\\Adriano\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.6.0
npm ERR! npm  v3.9.3
npm ERR! path C:\work\Dropbox\workspaces\ws-ionic\k2\node_modules\.staging\tryit-8b241062\package.json.3684708665
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename

npm ERR! Error: EPERM: operation not permitted, rename 'C:\work\Dropbox\workspaces\ws-ionic\k2\node_modules\.staging\tryit-8b241062\package.json.3684708665' -> 'C:\work\Dropbox\workspaces\ws-ionic\k2\node_modules\.staging\tryit-8b241062\package.json'
npm ERR!     at Error (native)
npm ERR!  { [Error: EPERM: operation not permitted, rename 'C:\work\Dropbox\workspaces\ws-ionic\k2\node_modules\.staging\tryit-8b241062\package.json.3684708665' -> 'C:\work\Dropbox\workspaces\ws-ionic\k2\node_modules\.staging\tryit-8b241062\package.json']
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'rename',
npm ERR!   path: 'C:\\work\\Dropbox\\workspaces\\ws-ionic\\k2\\node_modules\\.staging\\tryit-8b241062\\package.json.3684708665',
npm ERR!   dest: 'C:\\work\\Dropbox\\workspaces\\ws-ionic\\k2\\node_modules\\.staging\\tryit-8b241062\\package.json',
npm ERR!   parent: 'my-app' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\work\Dropbox\workspaces\ws-ionic\k2\npm-debug.log

Para resolver eu fiz duas coisas:
- rodei o comando "npm cache clean" (talvez esse passo não seja necessário, mas mal não faz)
- desativei temporariamente o antivírus (Avast)
e ao rodar novamente o "npm install" tudo funcionou perfeitamente!

Abraço!
Adriano Schmidt

segunda-feira, 6 de março de 2017

Ionic Android - AAPT: No resource found that matches the given name (at 'icon' with value '@drawable/icon')

E aí meu brother que está lendo esse artigo, tudo bom? :)

Rodei o comando "ionic build android" e tive o seguinte erro:

cp: no such file or directory: C:\work\Dropbox\workspaces\ws-ionic\my-app\resources\android\icon\drawable-ldpi-icon.png
cp: no such file or directory: C:\work\Dropbox\workspaces\ws-ionic\my-app\resources\android\icon\drawable-mdpi-icon.png
cp: no such file or directory: C:\work\Dropbox\workspaces\ws-ionic\my-app\resources\android\icon\drawable-hdpi-icon.png
cp: no such file or directory: C:\work\Dropbox\workspaces\ws-ionic\my-app\resources\android\icon\drawable-xhdpi-icon.png
cp: no such file or directory: C:\work\Dropbox\workspaces\ws-ionic\my-app\resources\android\icon\drawable-xxhdpi-icon.png
cp: no such file or directory: C:\work\Dropbox\workspaces\ws-ionic\my-app\resources\android\icon\drawable-xxxhdpi-icon.png
cp: no such file or directory: C:\work\Dropbox\workspaces\ws-ionic\my-app\resources\android\splash\drawable-land-ldpi-screen.png
cp: no such file or directory: C:\work\Dropbox\workspaces\ws-ionic\my-app\resources\android\splash\drawable-land-mdpi-screen.png
cp: no such file or directory: C:\work\Dropbox\workspaces\ws-ionic\my-app\resources\android\splash\drawable-land-hdpi-screen.png
cp: no such file or directory: C:\work\Dropbox\workspaces\ws-ionic\my-app\resources\android\splash\drawable-land-xhdpi-screen.png
cp: no such file or directory: C:\work\Dropbox\workspaces\ws-ionic\my-app\resources\android\splash\drawable-land-xxhdpi-screen.png
cp: no such file or directory: C:\work\Dropbox\workspaces\ws-ionic\my-app\resources\android\splash\drawable-land-xxxhdpi-screen.png
cp: no such file or directory: C:\work\Dropbox\workspaces\ws-ionic\my-app\resources\android\splash\drawable-port-ldpi-screen.png
cp: no such file or directory: C:\work\Dropbox\workspaces\ws-ionic\my-app\resources\android\splash\drawable-port-mdpi-screen.png
cp: no such file or directory: C:\work\Dropbox\workspaces\ws-ionic\my-app\resources\android\splash\drawable-port-hdpi-screen.png
cp: no such file or directory: C:\work\Dropbox\workspaces\ws-ionic\my-app\resources\android\splash\drawable-port-xhdpi-screen.png
cp: no such file or directory: C:\work\Dropbox\workspaces\ws-ionic\my-app\resources\android\splash\drawable-port-xxhdpi-screen.png
cp: no such file or directory: C:\work\Dropbox\workspaces\ws-ionic\my-app\resources\android\splash\drawable-port-xxxhdpi-screen.png

[...]
:CordovaLib:compileDebugJavaWithJavacNote: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

[...]
:CordovaLib:compileReleaseJavaWithJavacNote: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

:CordovaLib:processReleaseJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForRelease
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease
:CordovaLib:mergeReleaseJniLibFolders
:CordovaLib:transformNative_libsWithMergeJniLibsForRelease
:CordovaLib:transformNative_libsWithSyncJniLibsForRelease
:CordovaLib:bundleRelease
:prepareComAndroidSupportSupportV42411Library
:prepareDebugDependencies
:compileDebugAidl
:compileDebugRenderscript
:generateDebugBuildConfig
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets
:generateDebugResValues
:generateDebugResources
:mergeDebugResources
:processDebugManifest
:processDebugResourcesC:\work\Dropbox\workspaces\ws-ionic\my-app\platforms\android\build\intermediates\manifests\full\debug\AndroidManifest.xml:25:23-37 : AAPT: No resource found that matches the given name (at 'icon' with value '@drawable/icon').
 FAILED


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\work\Dropbox\android\sdk\build-tools\23.0.1\aapt.exe'' 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: 40.179 secs
ERROR building one of the platforms: Error code 1 for command: cmd with args: /s,/c,"C:\work\Dropbox\workspaces\ws-ionic\my-app\platforms\android\gradlew cdvBuildDebug -b C:\work\Dropbox\workspaces\ws-ionic\my-app\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: cmd with args: /s,/c,"C:\work\Dropbox\workspaces\ws-ionic\my-app\platforms\android\gradlew cdvBuildDebug -b C:\work\Dropbox\workspaces\ws-ionic\my-app\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"

Para resolver fiz o seguinte:
- Fui na pasta /platforms/android/res
- Criei uma pasta chamada "drawable"
- Coloquei um arquivo png qualquer chamado icon.png

Pronto, resolveu :)

Não sei se é a melhor solução, provavelmente não hahah Talvez seja algum conflito de versão ou versão desatualizada de algo (do sdk talvez)...
Como não sou eu que vou gerar o aplicativo para a play store, estou só resolvendo uns bugs aqui, então pra mim, essa solução foi suficiente... Talvez pra vc não tenha sido, mas acredito que posso ter te ajudado a pelo menos entender melhor o problema.

Fonte: http://stackoverflow.com/questions/4736523/no-resource-found-that-matches-the-given-name

Abraço!
Adriano Schmidt

Ionic Android - "Could not resolve all dependencies for configuration" e "Could not find any version that matches com.android.support:support"

Olá :)

Rodei o comando "ionic build android" e tive o seguinte erro:

Running command: C:\work\Dropbox\othertools\node\node.exe C:\work\Dropbox\workspaces\ws-ionic\my-app\hooks\after_prepare\010_add_platform_class.js C:\work\Dropbox\workspaces\ws-ionic\my-app
add to body class: platform-android
Running command: C:\work\Dropbox\othertools\node\node.exe C:\work\Dropbox\workspaces\ws-ionic\my-app\hooks\after_prepare\020_remove_sass_from_platforms.js C:\work\Dropbox\workspaces\ws-ionic\my-app
ANDROID_HOME=C:\work\Dropbox\android\sdk
JAVA_HOME=C:\work\Dropbox\java\windows\jdk1.8.0_60

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
   > Could not find any version that matches com.android.support:support-v4:24.1.1+.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/android/support/support-v4/maven-metadata.xml
         https://repo1.maven.org/maven2/com/android/support/support-v4/
         file:/C:/work/Dropbox/android/sdk/extras/android/m2repository/com/android/support/support-v4/maven-metadata.xml
         file:/C:/work/Dropbox/android/sdk/extras/google/m2repository/com/android/support/support-v4/maven-metadata.xml
         file:/C:/work/Dropbox/android/sdk/extras/google/m2repository/com/android/support/support-v4/
     Required by:
         :android:unspecified

* 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: 23.703 secs
ERROR building one of the platforms: Error code 1 for command: cmd with args: /s,/c,"C:\work\Dropbox\workspaces\ws-ionic\my-app\platforms\android\gradlew cdvBuildDebug -b C:\work\Dropbox\workspaces\ws-ionic\my-app\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: cmd with args: /s,/c,"C:\work\Dropbox\workspaces\ws-ionic\my-app\platforms\android\gradlew cdvBuildDebug -b C:\work\Dropbox\workspaces\ws-ionic\my-app\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"

Pra resolver:
- Abra o Android Studio
- Acesse: Tools > Android > SDK Manager
- Clique na aba SDK Tools
- Selecione "Android Support Repository"
- Dê um "Apply"
- Vá seguindo a instalação

Fonte: https://github.com/driftyco/ionic-cloud-issues/issues/107

É isso aí, abraço!
Adriano Schmidt