How to update version of a dependency which is required by other dependencies.
├─┬ vue-svgicon#3.2.9
│ └─┬ yargs#12.0.5
│ └── yargs-parser#11.1.1
In my case, yargs-parser needs to be updated to 13.1.1. Making any changes in the package-lock.json just overwrites it when you run npm install.
npm audit fix doesnt update it either
Tried doing with npm-shrinkwrap.json as an override for package-lock.json but want to find out some other alternative.
Another alternative is to do a define
"resolutions"
in the package.json file in addition to
"preinstall": "npm-force-resolutions"
but this adds an additional dependency of npm-force-resolutions which is not desired
Related
my npm was working perfectly fine, today I wanted to install a package and I got a lot of npm ERR! messages.
Then I saw that npm was creating package.json, package-lock.json, and a node_modules folder in the directory I was installing the packages in.
Shouldn't these files and folders be in /bin/ somewhere?
Then after I reinstalled some packages npm ls works but after some time it outputs:
├── #babel/code-frame#7.18.6 extraneous
├── #babel/helper-validator-identifier#7.19.1 extraneous
├── #babel/highlight#7.18.6 extraneous
├── #jridgewell/gen-mapping#0.3.2 extraneous
├── #jridgewell/resolve-uri#3.1.0 extraneous
├── #jridgewell/set-array#1.1.2 extraneous
But not just these, there are hundreds.
I just uninstalled Node and npm and re-downloaded it again.
But now when I tried to install a package it created a node_modules folder, package.json and package-lock.json in my home directory.
These files and the folder is not supposed be there, right?
Thank you!
npm list react-router
├─┬ react-router-config#5.1.1
│ └── react-router#6.2.1
└─┬ react-router-dom#5.2.1
└── react-router#5.2.1
If you look at react-router list, react-router#6.2.1 is downloaded under react-router-config#5.1.1 version.
I tried deleting react-router#6.2.1 in package-lock.json and doing a list.
react-router#6.2.1 keeps outputting.
So I replaced it with react-router-config 5.1.1 -> 5.0.1 .
And I tried npm list react-router, but it comes out the same.
├─┬ react-router-config#5.1.1
│ └── react-router#6.2.1
└─┬ react-router-dom#5.2.1
└── react-router#5.2.1
I deleted the 5.1.1 version of react-router-config and installed the 5.0.0 version, but I don't know if the 5.1.1 version still comes out.
And react-router#6.2.1 in the react-router-config list is not deleted either.
How to delete react-
Delete react-router-config#5.1.1 version, change the version to #5.1.0, and run npm list react-router to get the same result.
├─┬ react-router-config#5.1.1
│ └── react-router#6.2.1
└─┬ react-router-dom#5.2.1
└── react-router#5.2.1
If you use route 6, you need to migrate, so you can't migrate now.
How do I delete that version 6?
Install react-router-config as 5.1.0, delete lock and node_module, and then run npm install to get the same result.
├─┬ react-router-config#5.1.1
│ └── react-router#6.2.1
└─┬ react-router-dom#5.2.1
└── react-router#5.2.1
So I have a large React app created and set up with Create React App. Recently we started using Storybook to work on and create components. Its been great. However, we keep getting this weird webpack issue when we try to run or build the app. Here is the console log out:
> react-scripts start
There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.
The react-scripts package provided by Create React App requires a dependency:
"webpack": "4.41.2"
Don't try to install it manually: your package manager does it automatically.
However, a different version of webpack was detected higher up in the tree:
/Users/alexanderkaran/Documents/ClimateClever/cc_school_web/node_modules/webpack (version: 4.41.5)
Manually installing incompatible versions is known to cause hard-to-debug issues.
If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That will permanently disable this message but you might encounter other issues.
To fix the dependency tree, try following the steps below in the exact order:
1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
2. Delete node_modules in your project folder.
3. Remove "webpack" from dependencies and/or devDependencies in the package.json file in your project folder.
4. Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:
5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
6. Check if /Users/alexanderkaran/Documents/ClimateClever/cc_school_web/node_modules/webpack is outside your project directory.
For example, you might have accidentally installed something in your home folder.
7. Try running npm ls webpack in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed webpack.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.
P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cc_school_web#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cc_school_web#0.1.0 start 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! /Users/alexanderkaran/.npm/_logs/2020-01-23T05_20_16_003Z-debug.log
alexanderkaran#AlexandersMBP2 cc_school_web %
I know what your thinking you must have installed webpack, well I didn't. When I run:
npm ls webpack
I get this log out:
cc_school_web#0.1.0 /Users/alexanderkaran/Documents/ClimateClever/cc_school_web
├─┬ #storybook/react#5.3.8
│ ├─┬ #storybook/core#5.3.8
│ │ ├─┬ corejs-upgrade-webpack-plugin#2.2.0
│ │ │ └── webpack#4.41.5 deduped
│ │ └── webpack#4.41.5 deduped
│ └── webpack#4.41.5
└─┬ react-scripts#3.3.0
└── webpack#4.41.2
alexanderkaran#AlexandersMBP2 cc_school_web %
So the issue seems to be to do with storybook. If I uninstall all npm modules and remove storybook, then re-add both everything works again but eventually, it breaks.
Does anyone have a fix for this? Or am I missing something?
Looks like this an issue with the version of Webpack Create React App uses being a few steps behind the version Storybook uses sometimes.
There is no fix, but there are some workarounds.
You can find more info on the issue here:
https://github.com/storybookjs/storybook/issues/6505
One workaround is to add SKIP_PREFLIGHT_CHECK=true to a .env file in your project.
This can cause issue though.
Another workaround is to keep using a version of storybook and create react app that works with each other and doesn't cause these issues. So do not just upgrade storybook straight if it contains a Webpack version bump.
When I build my js application, I get error that a package(say A#0.94.2) is missing.
I do:
npm list A
This gives me a tree structure like this:
├── A#0.94.2
└─┬ B#0.94.3
└── A#0.94.2 deduped
What does it mean?
Also, it seems A#0.94.2 is available, so why do I get error?
Edit: NPM verions is 5.6.0
I am new to node.js and I am trying to install node-dev. Everytime I try to install I get his following error message:
npm WARN deprecated object-keys#0.2.0: Please update to the latest object-keys
/usr/local/bin/node-dev -> /usr/local/lib/node_modules/node-dev/bin/node-dev
node-dev#2.6.1 /usr/local/lib/node_modules/node-dev
├── filewatcher#1.1.2
├── resolve#1.1.6
├── node-notifier#4.1.2 (which#1.0.9, shellwords#0.1.0, clone#0.1.19, growly#1.2.0, semver#4.3.3)
├── dynamic-dedupe#0.2.0 (xtend#2.0.6)
└── dateformat#1.0.11 (get-stdin#4.0.1, meow#3.1.0)
I know it didn't install because when I run a script, it brings me back to the command prompt, instead of waiting for a change in file for it to restart automatically.
Any help would be really appreciated. Thanks!