node.js - linux对目录做软链后使用相对路径出错的问题
阿神
阿神 2017-04-17 11:53:02
0
1
562

我对一个路径src做了一个软链,最终目录结构是这样的

--a
----src
--------config.js
----config.json
--b
----src -> ../a/src
----config.json

我在src目录下的config.js中有这么一句,var obj = requrie('../config.json');结果我在b目录下运行这个js文件,它引入的是文件是a/src/config.json,我想让其引用b/config.json,求解决方案。

阿神
阿神

闭关修行中......

reply all(1)
大家讲道理

Soft links are generally not used in development. My understanding is that when deploying or publishing npm packages, the relative reference positions of soft links may not be saved, or there may be many pitfalls in processing.

If you do this, it is best to explain the usage scenario. There may be other ways to solve your needs.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template