Yarn & Npm for Jhipster - jhipster

I somehow have both yarn and npm for JHipster on my Linux Mint laptop. After I do the followings
yarn global remove generator-jhipster
yarn global add generator-jhipster
There isn't a result for
which jhispter
After I run the following commands
npm uninstall -g generator-jhipster
npm install -g generator-jhipster
an old version Jhipster shows up for
which jhispter
I have done an online search on the subject, but unable to resolve this problem after trying some methods mentioned on some posts.
How to get it right?

When confused about your local setup after installing JHipster through many ways (npm, yarn, linking from the sources, ...), I have found a way that works all the time. Recent version of NodeJs come with a useful tool called npx which can download a package from npm and execute it immediately. So the trick is simply to run:
npx generator-jhipster
You can also run a specific version, for example:
npx generator-jhipster#v5.3.4

Related

Why npm install -g #angular/cli?

I know there are lot many question regarding this npm package installing but I couldn't find the exact relevant answer, I have already installed npm and also developed few applications in my VStudio, Every time before developing the new project of angular do we need to install npm again by typing this in cmd "npm install -g #angular/cli?
Once you have installed #angular/cli globally, in the next project you just need run ng new app-name.
This command will create a folder named 'app-name', than will install all dependencies locally - including #angular/cli.
Installing #angular/cli globally allow you to use 'ng' command everywhere. It's required to install locally because to your project, some specific #angular/cli version is required and newer versions maybe brake.
If your #angular/cli global is newer than the local project version, 'ng' will use the local #angular/cli instead, when you run 'ng serve', for example.
Resume: after installed using npm install -g #angular/cli, you will need just to run ng new app-name.
No. You only need to run
npm i -g #angular/cli
Once ever (or when you update in the future)
And that's used to generate angular apps and different angular cli-related terminal commands. You don't need to run it ever again after that. But you will need to install it locally in your project so that certain things will work propertly

An asset cannot be written to a location outside the project - angular cli

I'm totaly confused right now. I'm not able to use ng serve anymore since i upgraded the Angular-CLI to > 1.5.3 because of the error i get:
An asset cannot be written to a location outside the project
So i tried to do a downgrade, i did it like this:
npm uninstall -g #angular/cli
npm uninstall -g angular-cli
npm cache clean --force
restarted windows pc
npm install -g #angular/cli#1.5.3
i did this three times and everytime i check which version is installed after i reinstalled the cli, it is 1.5.4 - i'm realy angry about this and don't know, what i'm doing wrong.
It's a known error in Versions higher than 1.5.3, you can have a look at it over here https://github.com/angular/angular-cli/issues/8613
so please, how can i install and use angular-cli at version 1.5.3
Please note, you may manually Copy node_modules\ng2-pdfjs-viewer\pdfjs to your public or asset folder or use any copy script as part of your build process.
Worked for me
Have you seen https://www.npmjs.com/package/ng2-pdfjs-viewer#step-2-copy-task-for-pdfjs

Previously installed jhipster 3.12 found after yarn installed 4.0.6

After installing yarn (0.20.3) for the very first time, yo (1.8.5), generator-jhipster with yarn global add generator-jhipster#4.0.6 and extend the $PATH as mentioned by the installation guide, the new version of jhipster istn't used. Instead, the jhipster 3.12.1 is found, which was always installed by node/npm.
yo is taken from $HOME/.config/yarn/global/node_modules/.bin
jhipster 4.0.6 is installed in $HOME/.config/yarn/global/node_modules/generator-jhipster
What should I do, that yo takes the latest jhipster installation?
I had the same issue when switching from npm to yarn.
Somehow "yo" still uses npm.
This solved the problem for me:
npm uninstall -g generator-jhipster
npm uninstall -g yo
If you were previously using NPM before Yarn, this question/answer would probably be relevant and helpful -- goes through the process of removing all of NPM's managed packages and not just for yo and generator-jhipster:
Yarn package won't upgrade globally (after migrating from NPM)
I decided to refuse using yarn and all problems disappeared :)

npm install bower using -g vs --save-dev

I'm new to node and using npm to both do some node, angular and Express tutorials. I have used bower before in a tutorial. I'm pretty sure I have installed it using -g already as when i run the bower -v command I get back 1.3.3 I am to understand that installing it using -g means, Install this globally so that on the next project I don't have to install it again.
1) Is this correct?
2) When I start working with a new project do I have to initialize bower?
3) Is there any reason I should use install bower --save-dev after I have already installed bower (-g)lobally?
4) What exactly does install bower --save-dev do?
I have searched and get nothing on google or stack over flow when I search "--save-dev".
I really want to understand this and if you help me, it will help me understand installing much more than just bower and how to use those installs. Again, I'm new to the command line for this type of development and new to these technologies, but have some basic understanding.
Using the --save and --save-dev flags when installing will add them to the project's package.json. This allows anyone who might develop on or use the project to install the dependencies as needed with a simple npm install command. By contrast, the -g flag is global only to your local machine.

I'm cloning a repo with Yeoman, what configuration do I need on my computer?

I have cloned a repo that has Yeoman installed.
I installed node, as well as Yeoman npm i -g yo. When I run grunt I get an error stating:
Error: Cannot find module 'load-grunt-tasks'
Warning: Task "default" not found. Use --force to continue.
What else do I need to do to be able to run this repo successfully?
The first time, you have to run npm install.
This will install all the needed dependencies as described in the package.json
Subsequently, if anyone add a new dependency into this file, you will need to run npm install or npm update again.
Actually besides npm, you should also download bower dependencies.
So it's 2-step:
npm install
bower install
If you don't invoke bower application may launch, but later you may encounter problems such as the lack of libraries.

Resources