Istanbul cover tests hang, then abort after 60 seconds - javascript

I'm using Istanbul for code coverage for a web app I'm creating. Whenever I run npm run cover --color=always (which runs : ../node_modules/babel-cli/bin/babel-node.js -- node_modules/.bin/babel- istanbul cover test/index.js --report=cobertura --print=detail --x=dist/** )
but nothing appears on the terminal until around 60 seconds later, when I get
this error:
TAP version 13
# application server
Aborted (core dumped)
However, if I write something that causes an error (like an undefined function) at the bottom of the index.js file, it will print the coverage out, along with that error.
Any thoughts on what could be wrong?

Hey so I have just run into this exact issue when running tests using the same tooling. What I discovered is that it is caused by a missing package or a package of the wrong version.
Just rm -rf node_modules and doing a fresh npm install seems to ensure that it is fixed.
Hope this helps you or anyone who comes across this in the future!

Related

How to resolve the build error on react-native?

I'm trying to make a build environment to make an android app but I haven't been able to succeed to build the project. The build log is as follows,
Starting Gradle Daemon...
Gradle Daemon started in 5 s 673 ms
:ReactNative:Running '[node, -e, console.log(require('react-native/cli').bin);]' command failed.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\WorkSpace\MyProject\node_modules\#react-native-community\cli-platform-android\native_modules.gradle' line: 179
* What went wrong:
A problem occurred evaluating script.
> Cannot run program "node" (in directory "C:\WorkSpace\MyProject\android"): CreateProcess error=2, �w�肳�ꂽ�t�#�C����������܂���B
It looks exactly same as the link below and I did the same thing but I can't resolve the problem and the log that it makes is always the same.
https://forums.expo.io/t/android-cannot-run-program-node-error-2-no-such-file-or-directory/37693
reinstall node. delete node modules and
clean and run the project again.
I can't comment so i answered.
I renew nodejs that I was using and it solved it.
Before:14.6.0
After:14.7.0
I don't know exactly why and node_modules seems to be not changed at all but at least a build succeeded.

Android Studio React Native Build fails

I took the project I am developing at my workplace home and wanted to run it here on my machine.
I got many many errors which I fixed, but there are some that I don't know how. Maybe you guys know a fix.
\android\app\build\intermediates\external_file_lib_dex_archives\debug\out
this output get generated when building the project from AS.
I read that the fix is to add this: android.enableBuildCache=false to gradle.properties but when I do that I get this error which make 0 sense tbh.
: Cannot parse project property android.enableBuildCache='false ' of type 'class java.lang.String' as boolean. Expected 'true' or 'false'.
EDIT: Ok there was an empty space after false hence the second error but even with that corrected I get the first error.
Running it from vsCode gives me: Execution failed for task ':app:processDebugResources'.
EDIT2: Newest Error in AS:
> Task :app:mergeExtDexDebug
java.nio.file.NoSuchFileException: C:\Users\Faded\Desktop\Development\React Native\FitnessApp\FitnessApp\android\app\build\intermediates\external_file_lib_dex_archives\debug\out
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsDirectoryStream.<init>(WindowsDirectoryStream.java:80)
at sun.nio.fs.WindowsFileSystemProvider.newDirectoryStream(WindowsFileSystemProvider.java:522)
at java.nio.file.Files.newDirectoryStream(Files.java:457)
at java.nio.file.Files.list(Files.java:3451)
at com.android.build.gradle.internal.tasks.DexMergingParams.getAllDexFiles(DexMergingTask.kt:502)
at com.android.build.gradle.internal.tasks.DexMergingTaskRunnable.run(DexMergingTask.kt:423)
at com.android.build.gradle.internal.tasks.Workers$ActionFacade.run(Workers.kt:335)
at org.gradle.workers.internal.AdapterWorkAction.execute(AdapterWorkAction.java:50)
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:50)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:65)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:61)
at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:98)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.execute(NoIsolationWorkerFactory.java:61)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:53)
at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:217)
at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:212)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:215)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:131)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.lang.Thread.run(Thread.java:748)
> Task :app:transformClassesWithDexBuilderForDebug
> Task :app:validateSigningDebug UP-TO-DATE
> Task :app:signingConfigWriterDebug
> Task :app:mergeDebugJavaResource
> Task :app:mergeExtDexDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeExtDexDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> java.nio.file.NoSuchFileException: C:\Users\Faded\Desktop\Development\React Native\FitnessApp\FitnessApp\android\app\build\intermediates\external_file_lib_dex_archives\debug\out
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 19s
150 actionable tasks: 147 executed, 3 up-to-date
Try to delete the .gradle folder from projectname/android - folder and rebuild. Solved it for me.
I have encountered a similar error before. As a result of my research as a solution
In the android/app/build.gradle file multiDexEnabled true
android {
defaultConfig {
...
targetSdkVersion 28
multiDexEnabled true // here
}
...
}
As Murat Kızılöz suggested, you can get around this by adding multiDexEnabled truein the android/app/build.gradle file.
This is because Android system has a 64K reference limit
In Android, the compilers convert your source code into DEX files. This DEX file
contains the compiled code used to run the app. But there is a limitation with the
DEX file. The DEX file limits the total number of methods that can be referenced
within a single DEX file to 64K i.e. 65,536 methods. So, you cant use more than
64K methods in a particular DEX file. These 64K methods include Android framework
methods, library methods, and methods in our code also. This limit of 64K is
referred to as the "64K reference limit".
So, if our app exceeds 65,536 methods, we will encounter a build error that indicates our app has reached the limit of the Android build architecture.
To get around this, you can manually enable this in the app build.gradle file
You can read more about this at Android Multidex
Try this command in your project root:
cd android && rm -rf .gradle && rm -rf .idea
and then
./gradlew clean
and then build again, works like a charm.
You can solve this issue by deleting the .gradle folder from "NameOfProject/android" and again running Android-Studio, I hoped this is solved. :))

expo init <project name> throwing npm ERROR (windows OS)

Just started with expo and React-Native and when I run
expo init ProjectName
I am getting an error stating:
Unexpected end of JSON input while parsing near '...,"version":"7.0.0-bet'
Process exited with non-zero code: 1
Set EXPO_DEBUG=true in your env to view the stack trace.
When I add the said thing in env (using set EXPO_DEBUG=true on windows), I get the following error:
Error: Process exited with non-zero code: 1
at ChildProcess.child.on (C:\Users\mohit\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\spawn-async\build\spawnAsync.js:39:21)
at ChildProcess.emit (events.js:182:13)
at ChildProcess.cp.emit (C:\Users\mohit\AppData\Roaming\npm\node_modules\expo-cli\node_modules\cross-spawn\lib\enoent.js:40:29)
at maybeClose (internal/child_process.js:962:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
It's something related to 'spawn-async'. I was also getting issues with 'spawn' sometime earlier while creating a node-server...but I resolved that there and then using 'exec' instead. Tried to find this on expo forums and even in react-native issues but couldn't find a solution. Can someone plz suggest something? Is it some "windows" thing only or something related to npm releases?
P.S: I also ran create-react-native-app ProjectName and again got a similar kind of error about end of JSON input!
Now I know what can be the issue, it can be just the trivial one:
Please update node an npm to the newest available version and please init you project again in different directory.
You'll need to have Node.js (version 10 or newer) installed on
your computer. Download the latest version of Node.js.
Additionally, you'll need Git to create new projects with Expo
CLI. You can download Git from here.
Make sure that you have installed these two things in your device.
Go to doc for expo installation
in my case. make sure you have yarn installed and update tour android studio packages, for it to work

WebStorm keeps crashing my locally ran server because of Git's index.lock

Error: EPERM: operation not permitted, lstat 'C:\ProjectDirectory\.git\index.lock'
at Error (native)
I'm using WebStorm and everytime I run the local server for testing purposes using npm start, it crashes inevitably sometimes after doing nothing, and sometimes after making a change or so.
I'm using this React boilerplate and the actual author responded to a bug issue I brought up about this saying "Based on the error, it looks like either your editor or your source control system is locking files."
I'm a bit tired restarting the server every time I make a couple changes and would love to fix this.
Full error log
Only IDE have reason to watch .git/ folder. So if something else tries then it's a bug in configuration.
npm start is an alias for npm-run-all --parallel test:watch open:src lint:watch.
Make sure that .git/ is exempted in their configuration.

EPERM: operation not permitted, lstat when running ng build

I'm getting an ERROR when trying to run ng build on my angular 4 app.
EPERM: operation not permitted, lstat '<dist directory>'
Has anyone encountered this issue?
TIA
I had the same problem.
As #Mauricio De La Quintana said, the problem is permission.
In my case (Windows environment), I solved the problem by removing the read-only property from the Repos folder and adding write permission to the Everyone user.
This probably a permission issue, just restart your IDE with admin permissions!
In my case I had to restart VsCode as administrator.
While running npm run build - I received error
Open Task Manager -> Select Chrome - > End Task
-> Select VSCode -> End Task
Opened the Project again -> Run npm run Build ---> worked for me
This has happened in my ASP.NET projects. For me this has happened for one of two reasons.
This can be a permission problem so you need to run Command Prompt as Admin.
a. Press win to open the start menu. Type in cmd to search for Command Prompt.
b. Press ctrl + shift + enter to launch Command Prompt as administrator.
This can happen when you build your web project in Visual Studio(or another IDE) and it is currently running.
a. This is a simple fix click the stop debugging and then try 'ng build' again.
Just restarted the VSCode and ran in admin. That solves my problem.
I saw this problem when running IISNODE...
Solution: Ensure that AppPool Identify from IIS has read permissions all the way from root of harddrive to website files.
Full answer is here https://github.com/tjanczuk/iisnode/issues/247
I had this issue while running a build on windows at the same time WSL was running in the directory. The issue was resolved by closing the WSL terminal.
Simply follow these steps
Restart VS Code
run npm run build
I think it is a permission problem, when you do ng build you also delete the previous files. I suggest using
sudo chown -R youruser /pathAngularApp
I had the same problem, and it was related to what #goku_da_master commented, I had the vueJs application running even when my VsCode stopped, I figured it out from the task manager and fixed it like this:
I opened the task manager
I searched if Node.js was running
Right click on the Node.js process
Finish Task
"npm run dev" again
I experienced the same problem. The fix for me was to install the correct node version that the project was requiring (an older one), then closing all terminal windows in VS Code, and relaunching VSC.
To switch node versions, I installed nvm and had to make sure the default alias was pointing towards the exact node version I wanted.
Error : Error: EPERM: operation not permitted, lstat 'C:\Users\Administrator'
We encountered this error after the Windows update.
This Solution worked for me;
Go to C:\Users\Administrator
Rename the file NTUSER.DAT as NTUSER-old.DAT

Categories