Somewhere in my yarn.lock file:
reactpack#^0.9.0:
resolved "https://registry.yarnpkg.com/reactpack/-/reactpack-0.9.0.tgz#ee3b7692a2c99231d5c235af87ad33d0d0cb6434"
dependencies:
...
react-hot-loader "^1.3.0"
...
I want to change react-hot-loader to "3.0.0-beta.6".
I tried to add following part to package.json:
"resolutions": {
"react-hot-loader": "3.0.0-beta.6"
}
but it is ignored by yarn :(.
Runing yarn --flat wants to flatten ALL packages (which is not what I want)...
Any other alternatives?
Related
I have a project with yarn (v1) workspaces.
project/
packages/
pkgA/
subPkgA1/
pkgB/
package.json has this:
"workspaces": {
"packages": [
"packages/pkgA",
"packages/pkgA/subPkgA1",
"packages/pkgB"]}
note that there's a nested workspace in there.
Top-level has jest#27.4.7 in its package.json.
pkgA has jest#24.9.0 because one of its dependencies requires that version; its package.json has no entry for jest.
pkgA/subPkgA1 has jest#27.4.7 in its package.json, BUT it actually gets 24.9.0 installed in its node_modules/.bin/jest, presumably because its parent workspace has that.
My main question is how to get jest#27.4.7 in the nested package subPkgA1? I tried adding an entry in pkgA's package.json, but that didn't help.
BTW, I know nested workspaces aren't fully supported until Yarn v2, but I can't upgrade right now, and I can't easily move my subpackage out of its parent, so any hacky solution would be better than nothing.
I am using the package "csv-file-validator": "^1.8.0" which comes with 3 dependencies
famulus "2.1.2"
lodash "4.17.15"
papaparse "^5.2.0"
I would like to update/force the version of lodash to be 4.17.20. I found about selective dependency resolution and did the following in my package.json
"resolutions": {
"csv-file-validator/lodash": "^4.17.20"
}
I removed my yarn.lock, the node_modules folder and ran yarn install once again. However, the lodash version is still 4.17.15
csv-file-validator#^1.8.0:
version "1.8.0"
resolved "https://pkgs.dev.azure.com/RCTechnologies/EMA/_packaging/EMA/npm/registry/csv-file-validator/-/csv-file-validator-1.8.0.tgz#f8b879f533ce8c84b115d0ed2eca8e691249ec22"
integrity sha1-+Lh59TPOjISxFdDtLsqOaRJJ7CI=
dependencies:
famulus "2.1.2"
lodash "4.17.15"
papaparse "^5.2.0"
Is it possible to achieve this? If so did I miss something, and what?
yarn.lock will always show the dependencies declared in that version's package.json. You needed to check lodash's entry instead which should look like
lodash#4.17.15, lodash#^4.17.20, <maybe other version strings>:
version "4.17.20"
...
while without that resolution you'd get
lodash#4.17.15, <maybe other version strings>:
version "4.17.15"
...
Or use yarn why lodash.
In my composer.json file, I have defined a dependency with an alias:
"require": {
"xxx/yyy" : "dev-branch as 1.2.3",
...
}
This dependency coresponds to a dependeny in another dependent package, which requires as well "xxx/yyy": "dev-branch as 1.2.3"
composer update rushes through and does not complain.
However, when I change the dependency in my project to
"require": {
"xxx/yyy" : ">=1.2.3",
...
}
composer complains and refuses to dissolve. I do not understand. To my comprehension, composer should load the latest version of dev-branch and treat it as if it would be version "1.2.3". It doesn't. Why?
Calling yarn commands inside a package that references a local lerna package fails with
- packages
- package1
- package2
say package2 references package1
dependencies: [
"#my-scope/package1": "^1.0.0"]
When I run any yarn command in package2 e.g. yarn add, or yarn list I get an error:
An unexpected error occurred: "https://registry.yarnpkg.com/#myscope%2package1: Not found".
I have run lerna bootstrap at the top level with
"npmClient": "yarn"
which successfully builds all my packages and the node_modules of package2 contains package1, however the yarn.lock file does not have any of the local packages
What might I be doing wrong?
Your dependence version should match origin's version, otherwise, yarn will lookup by internet instead local package
Say
packages1's package.json:
{
"name": "#my-scope/package1",
"version": "0.0.1"
}
packages2's package.json:
{
"name": "#my-scope/package2",
"dependencies": {
"#my-scope/package1": "^1.0.0"
}
}
yarn can's find that version match ^1.0.0, so it just try fetch from yarnpkg.com
In my .jsx module I get this error
Unable to resolve path to module
How can I fix it? The imported module exist.
I use eslint-plugin-import, github issue here
It might be that eslint-import doesn't automatically include the .jsx extension. You can try this:
Add to your .eslintrc:
"settings": {
"import/extensions": [".js", ".jsx"]
}
If just that doesn't help, try to add eslint-import-resolver-webpack as a devDependency.
npm i -D eslint-import-resolver-webpack
And include it in the .eslintrc settings:
"settings": {
"import/resolver": "webpack",
"import/extensions": [".js", ".jsx"]
}
You may need to configure the "module roots" in webpack:
resolve: {
modules: ['app', 'node_modules']
}
You might need to replace modules by root in webpack 1.x.
If it still don't work (and it does in command line), it might be a sublime linter issue: https://www.npmjs.com/package/eslint-plugin-import#sublimelinter-eslint