问题描述:
已经在项目package.json所在根目录 ./my_project 的 .yarnrc文件 中规定好了安装位置:
> --install.modules-folder "./media/node_modules"
--add.modules-folder "./media/node_modules"
registry "https://registry.yarnpkg.com"
但yarn install 运行约1-2分钟后过后无法在 ./my_project/media/node_modules文件夹生成所需要的依赖,该文件夹是空的。
cmd运行过程如下:
> (ENV) C:\my_project\my_project>yarn install
yarn install v1.22.19
warning package.json: No license field
info No lockfile found.
info Plug'n'Play support has been greatly improved on the Yarn v2 development branch.
info Please give it a try and tell us what you think! - https://next.yarnpkg.com/getting-started/install
warning my_project: No license field
[1/5] Resolving packages...
warning arches > @mapbox/mapbox-gl-draw > @mapbox/geojsonhint@2.2.0: Please make plans to check GeoJSON in some other way
warning arches > @turf/turf > @turf/bezier@4.7.3: Module has been renamed to @turf/bezier-spline
warning arches > @turf/turf > @turf/inside@4.7.3: Module has been renamed to @turf/boolean-point-in-polygon
warning arches > @turf/turf > @turf/collect > @turf/inside@4.7.3: Module has been renamed to @turf/boolean-point-in-polygon
warning arches > @turf/turf > @turf/isobands > @turf/inside@3.14.0: Module has been renamed to @turf/boolean-point-in-polygon
warning arches > @turf/turf > @turf/line-distance@4.7.3: Module deprecated in favor of @turf/length
warning arches > @turf/turf > @turf/line-chunk > @turf/line-distance@4.7.3: Module deprecated in favor of @turf/length
warning arches > @turf/turf > @turf/linestring-to-polygon@4.7.3: Module has been renamed to @turf/line-to-polygon
warning arches > @turf/turf > @turf/nearest@4.7.3: Module has been renamed to @turf/nearest-point
warning arches > @turf/turf > @turf/point-grid > @turf/inside@4.7.3: Module has been renamed to @turf/boolean-point-in-polygon
warning arches > @turf/turf > @turf/point-on-surface@4.7.3: Module has been renamed to @turf/point-on-feature
warning arches > @turf/turf > @turf/point-on-surface > @turf/inside@4.7.3: Module has been renamed to @turf/boolean-point-in-polygon
warning arches > @turf/turf > @turf/polygon-to-linestring@4.7.3: Module has been renamed to @turf/polygon-to-line
warning arches > @turf/turf > @turf/point-on-line@4.7.3: Module has been renamed to @turf/nearest-point-on-line
warning arches > @turf/turf > @turf/line-overlap > @turf/point-on-line@4.7.3: Module has been renamed to @turf/nearest-point-on-line
warning arches > @turf/turf > @turf/line-slice > @turf/point-on-line@4.7.3: Module has been renamed to @turf/nearest-point-on-line
warning arches > @turf/turf > @turf/line-split > @turf/point-on-line@4.7.3: Module has been renamed to @turf/nearest-point-on-line
warning arches > @turf/turf > @turf/tag > @turf/inside@4.7.3: Module has been renamed to @turf/boolean-point-in-polygon
warning arches > @turf/turf > @turf/within@4.7.3: Module has been renamed to @turf/points-within-polygon
warning arches > @turf/turf > @turf/within > @turf/inside@4.7.3: Module has been renamed to @turf/boolean-point-in-polygon
warning arches > @turf/turf > @turf/polygonize > polygonize > @turf/inside@4.7.3: Module has been renamed to @turf/boolean-point-in-polygon
warning arches > @mapbox/geojsonhint > jsonlint-lines > nomnom@1.8.1: Package no longer supported. Contact support@npmjs.com for more info.
warning arches > @turf/turf > @turf/unkink-polygon > simplepolygon > @turf/inside@4.7.3: Module has been renamed to @turf/boolean-point-in-polygon
warning arches > @turf/turf > @turf/unkink-polygon > simplepolygon > @turf/within@3.14.0: Module has been renamed to @turf/points-within-polygon
warning arches > @turf/turf > @turf/unkink-polygon > simplepolygon > @turf/within > @turf/inside@3.14.0: Module has been renamed to @turf/boolean-point-in-polygon
warning arches-dev-dependencies > node-sass > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning arches-dev-dependencies > node-sass > request > har-validator@5.1.5: this library is no longer supported
warning arches-dev-dependencies > node-sass > request > uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
warning arches-dev-dependencies > node-sass > node-gyp > make-fetch-happen > cacache > @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
[2/5] Fetching packages...
[3/5] Linking dependencies...
[5/5] Building fresh packages...
success Saved lockfile.
Done in 121.28s.
操作环境、软件版本等信息:
win 10命令行,yarn 1.22.19
尝试过的解决方法:
- 清除缓存yarn cache clean, 删除yarn.lock和package-lock.json文件,再试。
运行1-2分钟后,目标文件夹node_modules依然是空的 - 使用npm i命令。
npm i 运行结束后在 ./my_project根目录下直接生成了node_modules文件夹,里面安装的依赖齐全。但也无法生成在 ./my_project/media内。
我想要达到的结果:
使用yarn 1.22.19,yarn install命令能将需要的依赖下载在 ./media/node_modules 中