最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to put file path in package.json file - Stack Overflow

programmeradmin2浏览0评论

I want to make a script in package.json file where I can run a file which is not present in the same directory as the package.json file but it is present in parent folder of package.json file.

I want to do it like:

"scripts": {
    "server": "nodemon ../../ServerStarter.js",
}

I want to make a script in package.json file where I can run a file which is not present in the same directory as the package.json file but it is present in parent folder of package.json file.

I want to do it like:

"scripts": {
    "server": "nodemon ../../ServerStarter.js",
}

Here I want to run the ServerStarter.js file but I don't know how to put the file path in there. Please Help.

Share Improve this question edited Mar 21, 2021 at 7:54 Soumalya Bhattacharya asked Mar 20, 2021 at 13:59 Soumalya BhattacharyaSoumalya Bhattacharya 6841 gold badge12 silver badges30 bronze badges 2
  • If it's in the parent folder, the path should be ../, not ../../. If you do ../../, it references the parent folder's parent folder. – cbr Commented Mar 20, 2021 at 14:05
  • Yeah, sorry I had just put an extra pair of ../
发布评论

评论列表(0)

  1. 暂无评论