karatelabs/karate-npm

Nothing happen after execution - Java 17.0.1 - Node 16.14.0 - NPM 8.5.0

charlyautomatiza opened this issue · 10 comments

After following the steps to run on windows, nothing happen, there ir no error and no execution log.

After adding @karatelabs/karate dependency and install.

npm i

SO: Windows 10 Home

Java, NPM and Node version:

C:\dev\api>npm -v
8.5.0

C:\dev\api>node -v
v16.14.0

C:\dev\api>echo %JAVA_HOME%
C:\Program Files\Java\jdk-17.0.1

My test.js

#! /usr/bin/env node
const karate = require('@karatelabs/karate');
karate.exec();

My package.json.

{
  "name": "api",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "node test.js"
  },
  "keywords": [],
  "author": "CharlyAutomatiza",
  "license": "ISC",
  "devDependencies": {
    "@karatelabs/karate": "^0.2.1"
  }
}

But nothing happen when I run in cmd.

C:\dev\api>npm run test karate/httpbin.feature

> api@1.0.0 test
> node test.js "karate/httpbin.feature"

using curl + bash: com.intuit.karate:karate-core:1.2.0.RC5:all karate/httpbin.feature

C:\dev\api>

@charlyautomatiza thank you for reporting this - we do seem to have some issues on windows, see #1

it would be great if you can contribute. meanwhile I've created this issue at the jbang-npm project jbangdev/jbang-npm#4

the workaround would be for you to install jbang manually following the instructions here - and then repeat the npm i: https://www.jbang.dev/documentation/guide/latest/installation.html

it would be great if you can let me know if it works after you have manually installed jbang

Hi @ptrthomas Thanks for the quick reply.
I can confirm that after installing jbang manually my karate script works.

To install jbang manually in Windows Powershell:

iex "& { $(iwr -useb https://ps.jbang.dev) } app setup"

@charlyautomatiza really appreciate the quick feedback !

Not sure if this is same issue but I am getting below error when I am trying from powershell.

PS D:\personal\karate_projects\karate-npm> pwsh --version
PowerShell 7.2.2

npm details ::

PS D:\personal\karate_projects\karate-npm> npm -v
8.6.0
PS D:\personal\karate_projects\karate-npm> node -v
v17.8.0
PS D:\personal\karate_projects\karate-npm>

jbang details:

PS D:\personal\karate_projects\karate-npm> jbang version
0.92.2

When I clone this repo and perform npm i I am getting below issue.

PS D:\personal\karate_projects\karate-npm> npm i

> @karatelabs/karate@0.2.1 preinstall
> node preinstall.js

pre-installing karate ...
using jbang: com.intuit.karate:karate-core:LATEST:all
[jbang] Resolving dependencies...
[jbang] com.intuit.karate:karate-core:jar:all:LATEST
[jbang] [ERROR] Could not resolve dependencies from mavencentral=https://repo1.maven.org/maven2/
Unable to collect/resolve dependency tree for a resolution due to: Could not find artifact com.intuit.karate:karate-core:jar:all:LATEST, caused by: Could not find artifact com.intuit.karate:karate-core:jar:all:LATEST
  Could not find artifact com.intuit.karate:karate-core:jar:all:LATEST
[jbang] Run with --verbose for more details
pre-install of karate complete

up to date, audited 22 packages in 3s

4 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
PS D:\personal\karate_projects\karate-npm>

I check the url for maven => https://repo1.maven.org/maven2/
But there is karate or karate-core folder in it.

image

@rahulmr looks like you cloned the project and installed it ? that won't work because we haven't made the release of karate-all. it may work if you set karate.version = '1.2.0.RC5 as per the instructions.

please create a node project and use npm install to test 0.2.1

Yes it is working now with '1.2.0.RC5'.

closing as this will work correctly after releasing karate-npm 0.2.2

Hi Peter, I'm sorry to report we're having this same problem with the latest version of karate-npm.

Installing karate-npm and running tests was fine until about a month ago. Back then with karate-npm version 0.2.3, we'd get this popup on installation:
image
The jbang dependency would still install fine. The command npm run test would then execute our tests.

Today, when I do a clean install of 0.2.3, the installation still works but when I try to run a test, I see this output and no test executes.
image

When I try to do a clean install of the latest karate-npm version 0.3.1, the Windows popup above still appears, but now I also see a stack trace.
image
Also, the node_packages folder disappears after the install process finishes/crashes.

Any ideas would be greatly appreciated.
image

@ammar01 yes windows is known to be problematic. do consider contributing code or helping others to do so

Hi Peter, I'm sorry to report we're having this same problem with the latest version of karate-npm.

Installing karate-npm and running tests was fine until about a month ago. Back then with karate-npm version 0.2.3, we'd get this popup on installation: image The jbang dependency would still install fine. The command npm run test would then execute our tests.

Today, when I do a clean install of 0.2.3, the installation still works but when I try to run a test, I see this output and no test executes. image

When I try to do a clean install of the latest karate-npm version 0.3.1, the Windows popup above still appears, but now I also see a stack trace. image Also, the node_packages folder disappears after the install process finishes/crashes.

Any ideas would be greatly appreciated. image

For anyone who comes across this closed issue in future, the solution I found is as mentioned in the documentation. Manually install jbang first. I downloaded the latest version zip from https://github.com/jbangdev/jbang/releases, extracted it to a folder and added the /bin folder in there to my PATH environment variable. After this, doing an npm install of karate-npm was successful without any error.