getting NPM error while generating JHipster project - spring

Overview of the issue
I am getting NPM error while creating a simple project using JHipster or Yo Jhipster command
Related issues
Yes, I have checked for a similar issue but didn't find any issue similar to this with NPM.
Suggest a Fix
I think dependencies are available in staging in my case but the project is not getting its path properly.
JHipster Version(s)
5.7.2
JHipster configuration
INFO! Using JHipster version installed globally
INFO! Executing jhipster: info
INFO! Options: from-cli: true
Welcome to the JHipster Information Sub-Generator
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
"generator-jhipster": {
"promptValues": {
"packageName": "com.test"
},
"jhipsterVersion": "5.7.2",
"applicationType": "monolith",
"baseName": "JhipsterFirstApp",
"packageName": "com.test",
"packageFolder": "com/test",
"serverPort": "8080",
"authenticationType": "jwt",
"cacheProvider": "ehcache",
"enableHibernateCache": false,
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"prodDatabaseType": "mysql",
"searchEngine": "elasticsearch",
"messageBroker": false,
"serviceDiscoveryType": false,
"buildTool": "maven",
"enableSwaggerCodegen": false,
"jwtSecretKey": "bXktc2VjcmV0LXRva2VuLXRvLWNoYW5nZS1pbi1wcm9kdWN0aW9uLWFuZC10by1rZWVwLWluLWEtc2VjdXJlLXBsYWNl",
"clientFramework": "angularX",
"useSass": false,
"clientPackageManager": "npm",
"testFrameworks": [
"gatling"
],
"jhiPrefix": "jhi",
"otherModules": [],
"enableTranslation": false
}
}
JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
Environment and Tools
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
git version 2.16.1.windows.4
node: v10.15.0
npm: 6.5.0
yeoman: 2.0.5
yarn: 1.12.3
INFO! Congratulations, JHipster execution is complete!
Entity configuration(s) entityName.json files generated in the .jhipster directory
I am not sure, I think its related to NPM dependencies.
Browsers and Operating System
I am getting this as error msg on cmd.

Related

Install Bazel for Golang build applications in VScode

How to install bazel for golang application building in VScode?
There is no direct support for Bazel yet, as per golang/go issue 37205 ("x/tools/gopls: support for bazel-based projects")
bazelbuild/rules_go wiki/Editor-and-tool-integration has a design document for building editor and tool integration: a new gopackagesdriver binary that integrates Bazel+rules_go with golang.org/x/tools/go/packages.
But it is not fully implemented yet (Q1 2022).
In the meantime, you can follow Bazel IDE setup, which involves:
Create a launcher script, say tools/gopackagesdriver.sh:
#!/usr/bin/env bash
exec bazel run -- #io_bazel_rules_go//go/tools/gopackagesdriver "${#}"
adding in the .vscode/settings.json of your workspace:
{
"go.goroot": "${workspaceFolder}/bazel-${workspaceFolderBasename}/external/go_sdk",
"go.toolsEnvVars": {
"GOPACKAGESDRIVER": "${workspaceFolder}/tools/gopackagesdriver.sh"
},
"go.enableCodeLens": {
"references": false,
"runtest": false
},
"gopls": {
"build.directoryFilters": [
"-bazel-bin",
"-bazel-out",
"-bazel-testlogs",
"-bazel-mypkg",
],
"formatting.gofumpt": true,
"formatting.local": "github.com/my/mypkg",
"ui.completion.usePlaceholders": true,
"ui.semanticTokens": true,
"ui.codelenses": {
"gc_details": false,
"regenerate_cgo": false,
"generate": false,
"test": false,
"tidy": false,
"upgrade_dependency": false,
"vendor": false
},
},
"go.useLanguageServer": true,
"go.buildOnSave": "off",
"go.lintOnSave": "off",
"go.vetOnSave": "off",
}

Heroku - GIT Deployment Task :npmInstall FAILED

I initialized a JHipster project and tried to deploy it to heroku. I did nothing more than that and get the error below. Im not sure where the problem is, either the Jhipster release im using or Heroku i think. Should i try switching to another version of JHipster, or could this possibly be an issue of my local setup (npm-, node-, java-, gralde-version)?
JHipster Version(s)
generator-jhipster#6.10.1
JHipster configuration
{
"generator-jhipster": {
"promptValues": {
"packageName": "io.profit.testify",
"nativeLanguage": "en"
},
"jhipsterVersion": "6.10.1",
"applicationType": "monolith",
"baseName": "priv",
"packageName": "io.profit.testify",
"packageFolder": "io/profit/testify",
"serverPort": "8080",
"authenticationType": "jwt",
"cacheProvider": "ehcache",
"enableHibernateCache": false,
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"prodDatabaseType": "postgresql",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": false,
"buildTool": "gradle",
"enableSwaggerCodegen": false,
"jwtSecretKey": "YourJWTSecretKeyWasReplacedByThisMeaninglessTextByTheJHipsterInfoCommandForObviousSecurityReasons",
"embeddableLaunchScript": false,
"useSass": true,
"clientPackageManager": "npm",
"clientFramework": "angularX",
"clientTheme": "none",
"clientThemeVariant": "",
"creationTimestamp": 1595760910320,
"testFrameworks": [],
"jhiPrefix": "jhi",
"entitySuffix": "",
"dtoSuffix": "DTO",
"otherModules": [],
"enableTranslation": true,
"nativeLanguage": "en",
"languages": ["en", "de"],
"blueprints": [],
"herokuAppName": "afternoon-falls-71420",
"herokuDeployType": "git",
"herokuJavaVersion": "11"
}
}
Environment and Tools
java version "11.0.6" 2020-01-14 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.6+8-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.6+8-LTS, mixed mode)
git version 2.20.1.windows.1
node: v12.2.0
npm: 6.9.0
yeoman: 3.1.1
Error From Heroku Console:
Downloading https://services.gradle.org/distributions/gradle-6.5-bin.zip
remote: .................................................................................................
remote: To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/6.5/userguide/gradle_daemon.html.
remote: Daemon will be stopped at the end of the build stopping after processing
remote: > Task :bootBuildInfo
remote: > Task :nodeSetup SKIPPED
remote: > Task :npmSetup SKIPPED
remote: > Task :npmInstall FAILED
remote:
remote: FAILURE: Build failed with an exception.
remote:
remote: * What went wrong:
remote: Execution failed for task ':npmInstall'.
remote: > A problem occurred starting process 'command 'npm''
If you want to set the correct gradle task you can set it manually via heroku cli:
heroku config:set GRADLE_TASK="stage -Pprod -PnodeInstall"
In case the buildpack is not correctly set configure it via
heroku buildpacks:add heroku/gradle
After that try pushing again via
git push heroku master
And the build should work again.

How to set docker network mode in Visual Studio

How can I set the netwerk mode to host in my ASP.NET Core docker container?
I suspect it could be in the launchfile, but there is nothing about network or other docker related setting/flags.
Where can I specify them?
Thanks
On launchSettings.json => docker profile add DockerfileRunArguments as in the sample below:
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
"environmentVariables": {
"ASPNETCORE_URLS": "http://+:6002",
"ASPNETCORE_ENVIRONMENT": "Dev"
},
"publishAllPorts": false,
"httpPort": 6002,
"useSSL": false,
"DockerfileRunArguments": "--network=your-network -itd --name=web-api"
}
PS: You can use any docker run arguments there.

VS Code Property 'toString' does not exist on type 'number'

I hate asking this question, I imagine it is a very simple setting or typings thing that this fresh project is missing. The fact that it will run (via ts-node) tells me it is just VS Code complaining (but, why?) Google and SO searches turned up nothing concrete yet.
Visual Studio Code
Version 1.22.2
Commit 3aeede733d9a3098f7b4bdc1f66b63b0f48c1ef9
Date 2018-04-12T16:38:45.278Z
Shell 1.7.12
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64
> node -v
v9.10.0
> npm -v
5.6.0
> tsc -v
Version 2.8.3
> npm ls --depth=0
api-auth-test#1.0.0 C:\...
+-- #types/node#9.6.6
+-- axios#0.18.0
`-- typescript#2.8.3
> npm ls --depth=0 -g
C:\Users\...\AppData\Roaming\npm
+-- generator#1.0.1
+-- generator-gitignore#0.1.2
+-- npx#10.2.0
+-- ts-node#6.0.1
+-- tslint#5.9.1
+-- typescript#2.8.3
`-- yo#2.0.2
I found mention here of the tsdk setting in preferences, settings, and I ensured that typescript is installed into the local node_modules
"typescript.tsdk": "node_modules\\typescript\\lib\\",
Editing this, and the error disappears briefly, then returns (as VS refreshing its cache I imagine.)
tsconfig.json
{
"compilerOptions": {
"target": "esnext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"lib": [ ], /* Specify library files to be included in the compilation. */
"sourceMap": true, /* Generates corresponding '.map' file. */
"strict": true, /* Enable all strict type-checking options. */
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
}
}
package.json
{
"name": "api-auth-test",
"version": "1.0.0",
"description": "",
"main": "app.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"#types/node": "^9.6.6",
"axios": "~0.18.0",
"typescript": "^2.8.3"
},
"devDependencies": {}
}
Your tsconfig lib is missing the es2015 entry or rather is empty.
"lib": [
"dom",
"es2015"
],
Removing es2015 gave me the error you are facing.
For information on --lib option see What does the tsconfig option "lib" do?
I have observed similar issues with Angular 8 based solutions.These are set up with "es2018", after adding also "es2015" the red squigglies went away.
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "es2015",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/#types"
],
"lib": [
"es2018",
"es2015",
"dom"
]
}
}
Now, it might be the case that you should not mix these libs and just stick to one of these. But the point was to underline that Angular 8 uses "es2018" and I observed that adding "es2015" also fixed up some seemingly wrong errors that were fine when running inside the browser (false positives).

How can I get vs code debugger to find map files for debugging angular-cli webpack project

I am working on an angular-cli v1.0.5 (angular 4) project. Below is the output of the ng -v command.
#angular/cli: 1.0.5
node: 6.10.3
os: win32 x64
#angular/common: 4.1.3
#angular/compiler: 4.1.3
#angular/core: 4.1.3
#angular/forms: 4.1.3
#angular/http: 4.1.3
#angular/platform-browser: 4.1.3
#angular/platform-browser-dynamic: 4.1.3
#angular/router: 4.1.3
#angular/cli: 1.0.5
#angular/compiler-cli: 4.1.3
I am also using;
Typescript version 2.3.4
Webpack version 2.2.1
Chrome Version 58.0.3029.110 (64-bit)
Windows 10
VS Code version 1.13.0
Debugger for Chrome version 3.1.2
I am trying to get debugging to work in VS Code but all of my breakpoints are dimmed and when I hover over them, I get the message "Breakpoint ignored because generated code was not found."
Directory Structure - My project starts in the masclient folder. This is where my package.json and angular-cli.json files are at. Within the masclient folder, I have a src folder and within the src folder, I have an app folder. My angular 4 app.module.ts is in this folder. All of my components are in their own folders below the app folder. The specific typescript file I am trying to debug is in the masclient\src\app\bulk-labels\create-bulk-labels folder
My launch.json file is shown below;
{
"version": "0.2.0",
"configurations": [
{
"name": "LaunchChrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:4200",
"sourceMaps": true,
"webRoot": "${workspaceRoot}/src",
"diagnosticLogging": false,
"userDataDir": "${workspaceRoot}/.vscode/chrome",
"sourceMapPathOverrides": {
"webpack:///C:*": "c:/*"
}
},
{
"name": "AttachChrome",
"type": "chrome",
"request": "attach",
"port": 9222,
"sourceMaps": true,
"webRoot": "${workspaceRoot}/src",
"diagnosticLogging": true,
"sourceMapPathOverrides": {
"webpack:///*": "/*"
}
}
]
}
My angular-cli.json is shown below;
{
"$schema": "./node_modules/#angular/cli/lib/config/schema.json",
"project": {
"name": "masclient"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "masc",
"styles": [
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
"styles/vendor.scss",
"styles/main.scss"
],
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"../node_modules/tether/dist/js/tether.min.js",
"../node_modules/bootstrap/dist/js/bootstrap.min.js"
],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json"
},
{
"project": "src/tsconfig.spec.json"
},
{
"project": "e2e/tsconfig.e2e.json"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "scss",
"component": {}
}
}
My tsconfig.json file is shown below;
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "dist/out-tsc",
"baseUrl": "src",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/#types"
],
"lib": [
"es2016",
"dom"
]
}
}
I have gone through several recommendations I have found on Google with no luck. Most seem to refer to the process before angular-cli switched to webpack. There seem to be a lot of variation of property settings in the launch.json file. As I read through the posts before deciding to post my own question here, it seems that the issue may be related to the fact that the ng serve process keeps all of the compiled files in memory rather than pulling the map files from a ./dist folder... but I am not sure how that would change the location settings in the launch.json file.
I start debugging using the following process;
Run ng serve from the command line to start the web server
From within VS Code, I go to the Debug section and click on the green arrow next to "Launch Chrome" ( or press F5)
I have also tried this process;
Run ng serve from the command line to start the web server
Launch chrome.exe --remote-debugging-port=9222 from an admin level command prompt.
In the instance of Chrome that launched, navigate to locaohost:4200
From within VS Code, I go to the Debug section and click on the green arrow next to "Launch Chrome" ( or press F5)
With either of the startup methods listed above, wile viewing my source code *.ts files in the VS Code editor, I can see that my breakpoints are grayed out as soon as the debugger starts.
I am sure it probably just a matter of getting my settings in the various config files synced properly, but after several hours of research, the actual solution has eluded me.
Any help would be greatly appreciated.

Resources