Jhipster TS2440: Import declaration conflicts with local declaration of 'I - jhipster

Getting the following error while server startup in jhipster:
ERROR in .../webapp/app/shared/model/category-model.model.ts(1,10):
TS2440: Import declaration conflicts with local declaration of 'ICategoryModel'.
[INFO] npm ERR! code ELIFECYCLE
[INFO] npm ERR! errno 2
import { ICategoryModel } from 'app/shared/model/category-model.model';
export interface ICategoryModel {
subCategories?: ICategoryModel[];
parentCategory?: ICategoryModel;
}

It seems to be same issue as https://github.com/jhipster/generator-jhipster/issues/11549 it has been fixed on master branch and will be part of next release 6.9.0
In the meantime, you can just delete the import statement from category-model.model.ts

Related

Jenkins with Maven and npm process fails with EAGAIN error during npm install

So i got my jenkins pipeline setup for a application that uses spring boot as backend and vuejs as frontend. The maven build process builds the frontend first, copies that to the backend and then builds the backend. But during the build of the frontend the process fails ONLY if i run it through the jenkins pipeline. (for other people the same pipeline apparently works on a different machine)
[INFO] npm ERR! code EAGAIN
[INFO] npm ERR! syscall spawn sh
[INFO] npm ERR! path /var/lib/jenkins/workspace/pipeline/frontend/node_modules/pre-commit
[INFO] npm ERR! errno -11
[INFO] npm ERR! spawn sh EAGAIN
[INFO] npm ERR! command sh -c node install.js
[INFO]
[INFO] npm ERR! A complete log of this run can be found in:
[INFO] npm ERR! /var/lib/jenkins/.npm/_logs/2022-07-22T09_11_43_478Z-debug-0.log
the relevant part of the log is here: https://pastebin.com/ewp6zRcv
the jenkins pipeline is:
pipeline {
agent any
parameters {
gitParameter branchFilter: 'origin/(.*)', defaultValue: 'staging', name: 'BRANCH', type: 'PT_BRANCH'
}
tools {
maven "Maven"
nodejs "Node"
}
stages {
stage('Build') {
steps {
// Get some code from a GitHub repository
git branch: "${params.BRANCH}", url: 'https://github.com/TheExkaliburg/MoreFair'
// Run Maven on a Unix agent.
sh "mvn -Dmaven.test.failure.ignore=true clean package"
}
post {
success {
archiveArtifacts 'target/*.jar'
}
}
}
}
}
the jenkins is installed on a linux server with ubuntu 20.04 and the project itself can be found on https://github.com/TheExkaliburg/MoreFair and the branch to be built is staging
the strange thing is that EAGAIN failures are normally “Resource temporarily unavailable.” failures. running the process as root or as the jenkins user works fine without any errors, i have enough leftover disk space and my ram & cpu are never even close to getting to 100% during the build process
its also strange since the error that comes up is not always the same, f.e.
[INFO] - Building for production...
[INFO] node[80787]: pthread_create: Resource temporarily unavailable
[INFO] node:events:505
[INFO] throw er; // Unhandled 'error' event
[INFO] ^
[INFO]
[INFO] Error: spawn /var/lib/jenkins/workspace/MoreFairStaging/frontend/node/node EAGAIN
[INFO] at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
[INFO] at onErrorNT (node:internal/child_process:478:16)
[INFO] at processTicksAndRejections (node:internal/process/task_queues:83:21)
[INFO] Emitted 'error' event on ChildProcess instance at:
[INFO] at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
[INFO] at onErrorNT (node:internal/child_process:478:16)
[INFO] at processTicksAndRejections (node:internal/process/task_queues:83:21) {
[INFO] errno: -11,
[INFO] code: 'EAGAIN',
[INFO] syscall: 'spawn /var/lib/jenkins/workspace/MoreFairStaging/frontend/node/node',
[INFO] path: '/var/lib/jenkins/workspace/MoreFairStaging/frontend/node/node',
[INFO] spawnargs: [
[INFO] '/var/lib/jenkins/workspace/MoreFairStaging/frontend/node_modules/thread-loader/dist/worker.js',
[INFO] 20
[INFO] ]
[INFO] }
or
[7,371s][warning][os,thread] Failed to start thread - pthread_create failed (EAGAIN) for attributes: stacksize: 1024k, guardsize: 0k, detached.
the version for node are 16.16.0 and for npm 8.11; maven is on 3.8.6 with java 17 for maven and java 11 for jenkins (2.346.2)
So the problem with this specific case was that the service config didn't allow for more tasks to spawn
a simple way to fix this (after one week of recherche and trying a various amount of things) is systemctl edit jenkins and add to the config
[Service]
TaskMax=500
the number can vary but the default of 165 you can find out through systemctl show --property=DefaultTasksMax wasn't enough

A locally build NPM package - generated by the openapi-generator - does not seem to export the API, although it's available

I created a REST service interface definition with one very simple GET endpoint using OpenAPI 3.
(There is a minified version of that interface in the spoiler.)
{"openapi":"3.0.3","info":{"title":"Identity Cache API Definition","version":"1.0"},"tags":[{"name":"identity-cache"}],"paths":{"/{identityId}/data":{"get":{"tags":["identity-cache"],"summary":"Returns data.","operationId":"getIdentityData","parameters":[{"name":"identityId","in":"path","description":"The identity ID.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The identity data.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityData"}}}}}}}},"components":{"schemas":{"IdentityData":{"type":"object","required":["identityId"],"properties":{"identityId":{"type":"string"}}}}}}
Then I generated the typescript-fetch source code with the openapi-generator:
openapi-generator-cli generate -i ../identity-cache-api.yaml -o ./ -g typescript-fetch \
--additional-properties=supportsES6=true,typescriptThreePlus=true,npmVersion=1.0.0,npmName=identity-cache-fetch
After that I built the generated npm package with Node.js v14.7.0 using npm:
npm run build
And finally I added the built package locally to my project with npm install. Here is the added line in the package.json:
"identity-cache-fetch": "file:../identity-cache-npm-package",
Seems good, Visual Studio Code recognizes the new package and let me use it:
import { Configuration, IdentityCacheApi } from "identity-cache-fetch";
const identityCacheApi = new IdentityCacheApi(new Configuration({ basePath: import.meta.env.VITE_BACKEND_URL }));
However the build fails with: vite build
This error arises:
[INFO] error during build:
[INFO] Error: 'IdentityCacheApi' is not exported by ../identity-cache-npm-package/dist/index.js, imported by src/services/service.ts
[INFO] at error (../frontend/node_modules/rollup/dist/shared/rollup.js:160:30)
[INFO] at Module.error (../frontend/node_modules/rollup/dist/shared/rollup.js:12438:16)
[INFO] at Module.traceVariable (../frontend/node_modules/rollup/dist/shared/rollup.js:12808:29)
[INFO] at ModuleScope.findVariable (../frontend/node_modules/rollup/dist/shared/rollup.js:11601:39)
[INFO] at Identifier.bind (../frontend/node_modules/rollup/dist/shared/rollup.js:6479:40)
[INFO] at NewExpression.bind (../frontend/node_modules/rollup/dist/shared/rollup.js:5087:23)
[INFO] at VariableDeclarator.bind (../frontend/node_modules/rollup/dist/shared/rollup.js:5087:23)
[INFO] at VariableDeclaration.bind (../frontend/node_modules/rollup/dist/shared/rollup.js:5083:31)
[INFO] at Program.bind (../frontend/node_modules/rollup/dist/shared/rollup.js:5083:31)
[INFO] at Module.bindReferences (../frontend/node_modules/rollup/dist/shared/rollup.js:12434:18)
[INFO] npm ERR! code ELIFECYCLE
[INFO] npm ERR! errno 1
The index.js seems good. For simplicity, I'm only posting the TypeScript code of the uncompiled index.ts.
/* tslint:disable */
/* eslint-disable */
export * from './runtime';
export * from './apis';
export * from './models';
What am I missing?
Or is it a bug in the openapi-generator or vite?
It's an rollup issue.
By adding an ESM (ECMAScript Module) to the generated code the project finally builds.

Few test fail in protractor with 199 error

I am very new to protractor, I am fixing non-reg written by x-team members, the issue Im facing is all the test scripts work perfectly, except 3 of them, I am unable to find out how to start investigating the issue or what the issue could be.
the 199 error I have seen here is mostly associated with browser/ chrome driver issues, but hundreds of the other tests in the same folder work absolutely fine and these scripts get skip execution, hence they show result as fail.
I tried checking if there could be any issue in the script, but the script appears fine.
here is the error I get, when this particular script is run:
> mui-qa#1.0.0 prepro-run C:\mui_2jan
> node node_modules/typescript/bin/tsc || echo done
> mui-qa#1.0.0 pro-run C:\mui_2jan
> node node_modules/protractor/bin/protractor jsTranspiledFiles/config.js
spcefile: { browserName: 'chrome',
chromeOptions:
{ args:
[ '--start-maximized',
'--disable-web-security',
'--allow-file-access',
'--allow-insecure-localhost',
'--allow-running-insecure-content',
'--enable-automation' ] },
specs: [] }
[23:57:32] W/launcher - You have specified both capabilities and multiCapabilities. This will result in capabilities being ignored
[23:57:32] E/launcher - Spec patterns did not match any files.
[23:57:32] E/launcher - Error: Spec patterns did not match any files.
at Runner.run (C:\mui_2jan\node_modules\protractor\built\runner.js:322:19)
at TaskRunner.run (C:\mui_2jan\node_modules\protractor\built\taskRunner.js:110:27)
at createNextTaskRunner (C:\mui_2jan\node_modules\protractor\built\launcher.js:235:28)
at helper.runFilenameOrFn_.then.then.then (C:\mui_2jan\node_modules\protractor\built\launcher.js:260:13)
at _fulfilled (C:\mui_2jan\node_modules\q\q.js:834:54)
at self.promiseDispatch.done (C:\mui_2jan\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (C:\mui_2jan\node_modules\q\q.js:796:13)
at C:\mui_2jan\node_modules\q\q.js:604:44
at runSingle (C:\mui_2jan\node_modules\q\q.js:137:13)
at flush (C:\mui_2jan\node_modules\q\q.js:125:13)
[23:57:32] E/launcher - Process exited with error code 199
npm ERR! code ELIFECYCLE
npm ERR! errno 199
npm ERR! mui-qa#1.0.0 pro-run: `node node_modules/protractor/bin/protractor jsTranspiledFiles/config.js`
npm ERR! Exit status 199
npm ERR!
npm ERR! Failed at the mui-qa#1.0.0 pro-run script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\rbegum\AppData\Roaming\npm-cache\_logs\2021-02-05T18_27_32_296Z-debug.log
Any Idea?
Without seeing your config file, I see multiple problems:
specs: [] && Error: Spec patterns did not match any files. no specs specified. Maybe because it's specified in a wrong place
what is spcefile?
You have specified both capabilities and multiCapabilities. This will result in capabilities being ignored error. I would not recommend using multiCapabilities until you become comfortable with protractor
it seems that your specs list specs: [] is empty. you must provide the specs files which you want to execute in your script. the protractor.conf files do not know which file to execute.
Basically, in layman's terms, the flow is you write your specs file let's say spec1.ts, spec2.ts, and so on.
Then you need to mention those files in your protractor.conf files.
Details can be found https://www.protractortest.org/#/api-overview

Protractor : MicrosoftEdge Driver : Error: Error: Server terminated early with status 1

I have followed the below but still not able to run Microsoft edge
In windows to download the MicrosoftEdge Webdriver for the HTML version >= 18 then follow the below steps
Open Command Prompt, issue the following command and wait until operation gets completed
DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0
Open the File Explorer and navigate to C:\Windows\WinSxS and search for MicrosoftWebDriver and it will display two results, copy the webdriver from the amd64_microsoft-webdriver-server-components10.0.18362.1_none and paste it in
/c/Users/Administrator/AppData/Roaming/npm/node_modules/protractor/node_modules/webdriver-`manager/selenium
(Note: Using git bash, it's easy to copy the Webdriver)
In the config file of Edge browser, make the following changes
seleniumArgs:['-Dwebdriver.edge.driver=C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\protractor\\node_modules\\webdriver-manager\\selenium\\MicrosoftWebDriver.exe'],
capabilities: {
'browserName': 'MicrosoftEdge',
'maxInstances': 1,
'platformName': 'windows',
'nativeEvents': false,
shardTestFiles: true,
},
Open the command prompt, and navigate to project repo and issue the following command to start the edge session
webdriver-manager start --edge "C:\Users\Administrator\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\MicrosoftWebDriver.exe"`
Getting an error as :
[23:38:22] I/launcher - Running 1 instances of WebDriver
[23:38:22] I/local - Starting selenium standalone server...
[23:38:22] E/launcher - Error: Error: Server terminated early with status 1
at C:\Collabera\Web Automation\Spades3\node_modules\protractor\node_modules\selenium-webdriver\remote\index.js:252:52
at processTicksAndRejections (internal/process/task_queues.js:93:5)
[23:38:22] E/launcher - Process exited with error code 100
npm ERR! code ELIFECYCLE
npm ERR! errno 100
npm ERR! spades3#1.0.0 test: `protractor JSFiles/configuration.js`
npm ERR! Exit status 100
npm ERR!
npm ERR! Failed at the spades3#1.0.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Thanks
Aakash Paliwal

babel.config.js: Error while loading config - Cannot find module 'fibers'

This is driving me nuts.
IDE: Visual Studion 2019
Project: Created a new "Basic Vue.js project" - I chose the *.ts flavour
I validate the new site runs. It does.
Following the quick start on Vuetify : https://vuetifyjs.com/en/getting-started/quick-start/#bootstrapping-the-vuetify-object
After each step I validate the site will still compile and run.
I reach the section where we add new modules to our project. I run this line:
npm install sass sass-loader fibers deepmerge -D
And now the site will not run. When I debug I get this output:
------ Build started: Project: MCCC.Web, Configuration: Debug Any CPU ------
> mccc.web#0.1.0 build C:\Labs\MCCC\Web\MCCC-Web\MCCC.Web
> vue-cli-service build
- Building for production...
Starting type checking service...
Using 1 worker with 2048MB memory limit
ERROR Failed to compile with 1 errors5:04:50 PM
error in ./src/main.ts
Module build failed (from ./node_modules/thread-loader/dist/cjs.js):
Thread Loader (Worker 0)
C:\Labs\MCCC\Web\MCCC-Web\MCCC.Web\babel.config.js: Error while loading config - Cannot find module 'fibers'
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:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (C:\Labs\MCCC\Web\MCCC-Web\MCCC.Web\babel.config.js:17:32)
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)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
# multi ./src/main.ts
ERROR Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mccc.web#0.1.0 build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mccc.web#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Dwainwright.BC\AppData\Roaming\npm-cache\_logs\2020-04-26T21_04_50_521Z-debug.log
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VisualStudio\v16.0\Node.js Tools\Microsoft.NodejsToolsV2.targets(60,5): error MSB3073: The command "npm run build" exited with code 1.
Done building project "MCCC.Web.njsproj" -- FAILED.
Build FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
The line that sticks out the most to me is:
C:\Labs\MCCC\Web\MCCC-Web\MCCC.Web\babel.config.js: Error while loading config - Cannot find module 'fibers'
fibres is references in the babel.config.json where I added the rules laid out in quick start:
module.exports = {
presets: [
'#vue/app',
'#babel/preset-env'
],
rules: [
{
test: /\.s(c|a)ss$/,
use: [
'vue-style-loader',
'css-loader',
{
loader: 'sass-loader',
// Requires sass-loader#^7.0.0
options: {
implementation: require('sass'),
fiber: require('fibers'),
indentedSyntax: true // optional
},
// Requires sass-loader#^8.0.0
options: {
implementation: require('sass'),
sassOptions: {
fiber: require('fibers'),
indentedSyntax: true // optional
},
},
},
],
},
]
};
Does anybody know how i can resolve this? Happy to share further info; not sure what else you may need.
Are you using the latest version of the docs? I followed the link you provided and the anchor #bootstrapping-the-vuetify-object doesn't appear to exist anymore. I was able to get a basic project up and running successfully following these steps:
vue create myapp: Selected "custom" and ticked all the boxes, for TypeScript, chose the default "class-style components"
verified that npm run serve worked
vue add vuetify: Selected "Configure", and these options:
Y (default)
y
y
Material Design Icons (default)
N (default)
Y (default)
English (default)
npm run serve would run, but I got warnings about type declaration for vuetify/lib. This answer led me to this FAQ item which made the warnings go away. (You have to add "vuetify" to the compilerOptions.types array in the root tsconfig.json for the project.)
FWIW, fibers does not appear to be included in the project at all anymore (searched for "fibers" in package-lock.json). My babel.config.js file looks like:
module.exports = {
presets: [
'#vue/cli-plugin-babel/preset'
]
}
And vue.config.js looks like:
module.exports = {
transpileDependencies: [
'vuetify'
]
}
Hope this helps!

Resources