Npm ci : why no peer dependencies error on vscode terminal - node.js

I have a react repo that in a github action , while doing "npm ci", gives a "Conflicting peer dependency" problem ( using npm 8.5.5 , node 16.14-alpine ).
And that's fine because npm >=7 blocks installations of peer dependencies if it finds any conflict.
But I don't understand why, if I replicate the "npm ci" command in my vscode terminal using very similar versions (npm 8.5.0 and node v16.14.2), I see no error and the installation correctly completes? :-/
Any idea?

I have this problem as well. By installing with --legacy-peer-deps locally and running ci with the same flag, things work. I have not been able to answer why peer dependencies install correctly in my local environment but not with Github actions. I have verified that I'm running the same node version in both places. It seems that if dependencies install locally without the legacy flag, they should in Github Actions, but that is not my experience.
npm i --legacy-peer-deps
npm ci --legacy-peer-deps

Related

npm ci giving Conflicting peer dependency

I am trying to install the dependencies from docker file with command RUN npm ci. But I am getting the following error Conflicting peer dependencies. Fix the upstream dependency conflict, or retry this command with --force, or --legacy-peer-deps to accept an incorrect (and potentially broken) dependency resolution.. In my local project I have overcome this issue while running npm install --force. How I can fix this inside the docker while building and running this command RUN npm ci.
As I have understood npm ci will look it either from the package-lock.json or npm-shrinkwrap.json. But still facing this issue. Cannot figure it out what is causing this.
They introduce a breaking changes in npm#8.6 (yes! a minor version bump, with a major breaking changes).
The update changes the behavior of package installation, both from npm install and npm ci.
Previously, the npm ci command would blindly install whatever was in the lock file. AS IS, it will validates both the package-lock.json and package.json is in a consistent state.
You could read more about the issue here: github.com/npm/cli/issues/4998, github.com/npm/cli/issues/5113, and github.com/npm/cli/issues/4664
I also started to get this error on pipe. What is interesting I always have had peer dependency conflict but it was only appearing with npm install. The best option is to run script with flag --legacy-peer-deps it will skip checking peer dependency. Peer dependency should be installed manually in package.json.
npm i --force
solved my problem
Note : I got :
added 482 packages, and audited 483 packages in 3m
Some issues need review, and may require choosing
a different dependency.

npm install cypress throws an error on node16

Since migrating from node14 to node16, cypress is not being installed on 'npm install' and throws an error:
i think iv tried everything from reinstalling node16 to using 'sudo npm install'
its solved by either switching to node14 OR erasing the cypress line from package.json, but i need node16+cypress.
my 'nvm ls':
this issue is related to is-installed-globally npm package and it won't let me install it as well
It sounds like npm itself is out of alignment with node. Try updating with
npm update npm -g
then re-install Cypress
For everyone who finds this in the future.
I was having the same trouble described above. The new version of cypress works with node 16.
node version 16.14.2
cypress.io version 10.0.3

nodejs conflicting with vue native router

nodejs version 14.17.5
vue native version 0.3.0
I am developing an application that requires navigation in APP.
When i give command "npm run start" the application successfully runs.
Package.json dependencies installed:
enter image description here
For navigation when i run command "npm install view-native-router" it shows the error message as below:
enter image description here
Does anybody have the idea what could possibly have gone wrong? Is it a compatibility issue ?
It seems this is not the first time we have a peer dependency problem here and the last issue was marked as solved.
https://github.com/GeekyAnts/vue-native-router/issues/45
Since you have a higher version of vue-native-core in local, try add --legacy-peer-deps to npm install to see if works.
Though --force or --legacy-peer-deps may work for some but not everyone.
My solution is to start using yarn! Install it by the following:
$ npm i -g yarn
After its installed, its advised that you delete the project and redo the vue-native-cli init command so it can use yarn from there, but you can also just directly use the following command without deleting the project:
$ yarn install vue-native-scripts

Undefined variable: "$font-weight-bolder" when running npm development server

In a vue project, that is worked on by a lot of people a recently started to get this error when running:
npm run dev
error when starting development server
When running npm install, I also get this warning which might be related to the problem:
npm WARN bootstrap#4.5.0 requires a peer of popper.js#^1.16.0 but none is installed. You must install peer dependencies yourself.
I believe this is happening since I updated my node version, but I'm not sure.
From my research this problem might be related to node-sass or the css-loader.
Details:
Windows 10 64bit
node version: 12.16.3
npm version: 6.14.4
What I've already tried
Completely uninstall node and reinstall it
Try different node versions with nvm (I always deleted node_modules and package.lock and ran npm install again)
Completely delete my git repository and start fresh
Delete node_modules and run "npm ci"
install the css loader
Other development environments work fine so it's most likely something specific with this repository and my machine but I don't really know how to find the problem.
And also, the environment was working fine for me a couple of days ago so it's not a general problem in this repository.

unable to upgrade npm to version 1.4.3

My original problem is something similar to this post -> yeoman error peerinvalid Peer generator-webapp#0.5.0 wants yo#>=1.2.0
However, I tried doing the following in the command prompt (windows machine):
e:\Code\html5>npm install -g npm#1.4.3
npm http GET https://registry.npmjs.org/npm/1.4.3
npm http 304 https://registry.npmjs.org/npm/1.4.3
npm WARN package.json github-url-from-git#1.1.1 No repository field.
C:\Users\deostroll\AppData\Roaming\npm\npm -> C:\Users\deostroll\AppData\Roaming
\npm\node_modules\npm\bin\npm-cli.js
npm#1.4.3 C:\Users\deostroll\AppData\Roaming\npm\node_modules\npm
e:\Code\html5>npm -v
1.3.21
Notice that I get 1.3.21 instead of 1.4.3
What is the correct way to upgrade npm?
I had the same problem. It appears that the npm installer creates two versions on windows systems and the updates are not applied to the version used by the CLI.
This is described in more detail here (NPM GitHub repo) and here (NPM GitHub Troubleshooting).
As mentioned in the GitHub repo there is a tool by microsoft that will cumbersome workaround described in the troubleshooting guide automatically for you:
https://github.com/felixrieseberg/npm-windows-upgrade
You basically have to start a PowerShell as admin, install the tool and execute it:
npm install -g npm-windows-upgrade
npm-windows-upgrade
See the tool's GitHub page for more info.
This helped me solve the problem, the tool lets you actually choose between any version of npm (including previous versions, alpha and beta releases).
"Don't panic" if it throws a few errors at first, it did that to me too, but everything worked fine in the end :)
I've had success using npm update -g npm. Installing a parallel version is not something I've tried doing, though, if that was your intent.

Resources