Yarn install - bad hash behind private registry - Jhipster v5 upgrade - jhipster

I report an issue with Yarn and the installation of Javascript dependencies from a Jhipster v4 to Jhipser v5.0.1 (Angular stack) throug a private Nexus Npm proxy and private Artifactory registry
However, I am experiencing sha1sum errors when installing javascript dependencies with Yarn
Exemple :
> [INFO] [1/5] Validating package.json...
> [INFO] [2/5] Resolving packages...
> [INFO] [3/5] Fetching packages...
> [ERROR] error http://registry.npmjs.org/compression/-/compression-1.7.2.tgz: Fetch
> succeeded for undefined. However, extracting
> "http://registry.npmjs.org/compression/-/compression-1.7.2.tgz"
> resulted in hash "b0850fe39bd92980d49335a26b3deb4fcc71a64d", which did
> not match the requested hash "aaffbcd6aaf854b44ebb280353d5ad1651f59a69".
Sometimes it's with these libraries:
follow-redirects-1.5.1
onetime-1.1.0
compression-1.7.2
With Node v8.9.4 or v8.11.3
Whether with Yarn 1.6.0, 1.7.0 or 1.8.0
I of course did that:
Do a yarn cache clean
Delete node_modules/
Remove yarn.lock
Add the Yarn flag --skip-integrity-check
Whith an curl http://private-artifactory/compression/-/compression-1.7.2.tgz the sha1sum is OK
It's also OK with an direct internet access (without corporate Npm proxy)
Same mistake on our dev posts or our Jenkins docker CI-CD (Debian 9)
The issue is the same with our Nexus proxy or our private registry Artifactory
Also no problem with our code branch stayed in Jhipster v4
Yarn closed ticket did not help us : https://github.com/yarnpkg/yarn/issues/3354
And the way around that I found is to use the --update-checksums flag on every Yarn commands
yarn install --update-checksums
and with Maven frontend-maven-plugin eirslett in the pom.xml :
<goals>
<goal>install-node-and-yarn</goal>
<goal>yarn</goal>
</goals>
<configuration>
<arguments>install --update-checksums</arguments>
</configuration>
I would be happy to receive any help or explanations :)
UPDATE:
Return to normal with Yarn v1.9.4 :)

I had similar issue with modernizr. So I removed it from package.json, then did:
yarn install
and then
yarn add modernizr
So the idea basically to remove wrong package, and then add it after installation.

Related

How to configure yarn for installing private GitLab package using instance-level registry

Yarn fails to install private GitLab package using instance-level registry setup.
I have successfully published a scoped package #myorg/mypackage to my GitLab instance using a project-level registry from a CI build. I can see the package my GitLab repository's Package Registry UI. I can also use browser to download the tar file. Installing the package to npm project succeeds using the instance-level registry and a personal access token.
.npmrc contents (anonymized)
#myorg:registry=https://myorgsgitlab:port/api/v4/packages/npm/
//myorgsgitlab:port/api/v4/packages/npm/:_authToken=asdf
always-auth=true
However, if I try using yarn, the installation fails with the following:
info No lockfile found.
[1/4] Resolving packages...
verbose 0.1727709 Performing "GET" request to "https://myorgsgitlab:port/api/v4/packages/npm/#myorg%2fmypackage".
verbose 0.5582721 Request "https://myorgsgitlab:port/api/v4/packages/npm/#myorg%2fmypackage" finished with status code 200.
[2/4] Fetching packages...
verbose 0.689239 Performing "GET" request to "https://myorgsgitlab:port/api/v4/projects/27/packages/npm/#myorg/mypackage/-/#myorg/mypackage-1.0.2.tgz".
verbose 0.7588204 Error: https://myorgsgitlab:port/api/v4/projects/27/packages/npm/#myorg/mypackage/-/#myorg/mypackage-1.0.2.tgz: Request failed "404 Not Found"
at ResponseError.ExtendableBuiltin (C:\Users\vivid\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:696:66)
So I tried adding another line to .npmrc
//myorgsgitlab:port/api/v4/projects/27/packages/npm/:_authToken=asdf
The same error is still occurring.
If I change the #myorg:registry setting to the project specific address (the one with /projects/27/) the installation succeeds. However, that is not an option as I have multiple packages under #myorg scope and they come from different repositories (project ids).
Yarn version v1.22.18
GitLab version 14.9.0

Consequences of disabling check_yarn_integrity?

I see a common message when trying to start the rails server:
rails s
=> Booting Puma
=> Rails 6.0.3.2 application starting in development
=> Run `rails server --help` for more startup options
error Couldn't find an integrity file
error Found 1 errors.
========================================
Your Yarn packages are out of date!
Please run `yarn install --check-files` to update.
========================================
To disable this check, please change `check_yarn_integrity`
to `false` in your webpacker config file (config/webpacker.yml).
yarn check v1.22.10
info Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command.
I have tried for 2 days to fix this. Deleting node_modules and reinstalling, etc, but nothing I do has worked. So I am considering doing as the message suggests and disabling the yarn integrity check.
Question
What does this integrity check do, and should I be worried about disabling it?
Notes
Disabling this integrity check is suggested/recommended in a few places, including
https://github.com/rails/webpacker/issues/1374#issuecomment-495280789
Info
I reinstalled nvm, node and yarn just to eliminate possible causes of problems:
nvm -v
0.38.0
node -v
v16.0.0
npm -v
7.10.0
yarn -v
1.22.10
have you tried running the suggested command?
yarn install --check-files
you could also try reinstalling webpacker, which will create a new manifest file which will pass integrity checks:
rails webpacker:install
An update, the errors I was getting were very widespread, caused by a incompatibility with node 16 and a dependency (node-sass).
So rather than turn off the integrity check, I simply used nvm to downgrade to node 14

Trouble Installing "mobius-client-js"

Keep failing to install mobius-client-js"
C:\WINDOWS\system32>yarn add #mobius-network/mobius-client-js
yarn add v1.12.3
[1/4] Resolving packages...
[2/4] Fetching packages...
error #mobius-network/mobius-client-js#0.5.0: The engine "node" is incompatible with this module. Expected version ">=4 <=9". Got "10.14.1"
error Found incompatible module
Per Yarn's docs, you can use the following methods to add:
You can also specify packages from different locations:
yarn add package-name installs the package from the npm registry
unless you have specified another one in your package.json.
yarn add file:/path/to/local/folder installs a package that is on
your local file system. This is useful to test out other packages of
yours that haven’t been published to the registry.
yarn add file:/path/to/local/tarball.tgz installs a package from a
gzipped tarball which could be used to share a package before
publishing it.
yarn add <git remote url> installs a package from a remote git
repository.
yarn add <git remote url>#<branch/commit/tag> installs a package from
a remote git repository at specific git branch, git commit or git tag.
yarn add https://my-project.org/package.tgz installs a package from a
remote gzipped tarball.
None are working... any help would be amazing.
As per your error message:
The engine "node" is incompatible with this module. Expected version ">=4 <=9". Got "10.14.1"
It looks like you are running NodeJS 10.14.1, but the mobius-client requires a NodeJS version between 4 and 9. You should either check if there's a compatible version of this library or use something like nvm to switch to a previous version of node.

npm install not working in laravel 5.6

On a fresh install of laravel 5.6 via composer
How I installed it:
composer create-project laravel/laravel
After installing I ran:
npm install
I get back:
npm notice created a lockfile as package-lock.json. You should commit this file. Up to date in 0.163s.
It does not create a node_modules folder.
If I try using yarn to install the dependencies using:
yarn install
I get back:
yarn install v1.3.2 info No lockfile found. Resolving packages... warning laravel-mix > img-loader > imagemin-mozjpeg > mozjpeg > bin-wrapper > download > gulp-decompress > gulp-util#3.0.8: gulp-util is deprecated - replace it, following the guidlines at https://medium.com/gulpjs/gulp-util-ca3b1f9fac5 | Fetching packages... info fsevents#1.1.3: The platform 'win32' is incompatible with this module. info "fsevents#1.1.3" is an optional dependency and failed compatability check. Excluding it from installation. Linking dependencies.... Building fresh packages... success Saved lockfile. Done in 35.38s
This creates a node_modules folder with only ".yarn-integrity' no modules.
The link to the medium page doesn't work, receive 404 so no luck there.
My node version is: "v8.9.4" and my yarn version is: 'v1.3.2'
Edit: This isn't a git issue. I'm not using git
running:
npm install --dev or npm install --only=dev
This installed the dependencies I needed. For whatever reason in laravel 5.6 all the dependencies are considered devDependencies in the package.json file.
package-lock.json is automatically generated for any operations where npm modifies either the node_modules tree, or package.json. It describes the exact tree that was generated, such that subsequent installs are able to generate identical trees, regardless of intermediate dependency updates.
Run the following command
git add -A
git commit -m "Commit package-lock.json"
git push -u origin master
Now re-run npm install
Just make sure you are in your project directory e.g
1) cd path/to/my_laravel_project
2) npm install
this because you are not in laravel root folder, when you create a project, at first you are not in folder you need to open your project folder and use
npm i

Problems installing jhipster: "bash: jhipster: command not found"

Im trying to install jhipster my very first time and having already problems with the setup :o
I was following the steps on the "Installing JHipster" page for "Local installation with Yarn" (using Angular) which was working fine but now continuing with "Creating an application" gives me an error when trying to execute jhipster:
To generate your application, type:
jhipster
It seems there is just no jhipster binary in my environment even with following the setup steps described in the docs before:
test#test ~/git/test $ yarn global add generator-jhipster
yarn global v1.3.2
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "generator-jhipster#4.13.3" with binaries:
- jhipster
Done in 1.53s.
test#test ~/git/test $ jhipster
bash: jhipster: command not found
Was using this page for installing the requirements and this page for creating the app (having gentoo linux installed). As i was never using yarn or yeoman before im not sure if im missing something here like using a prefix or another program executing "jhipster".
Problem was i didn't have the yarn bin path added to my users PATH. See the comments for more informations.
If you have problems using Yarn globally, be sure to have $HOME/.config/yarn/global/node_modules/.bin in your path.

Resources