简体   繁体   English

IISNode缓存旧文件名,我似乎无法更新它

[英]IISNode caching old file names and I can't seem to update it

Hello and thank you in advance.您好,提前谢谢您。 This may be a rather simple scenario, however, I am new to Nodejs.这可能是一个相当简单的场景,但是,我是 Nodejs 的新手。 I have a main script which I am calling from javascript using IISNode.我有一个主脚本,我使用 IISNode 从 javascript 调用它。 Everything has worked great until I decided to rename a dependency file.在我决定重命名依赖文件之前,一切都很好。

Files involved:涉及文件:

  • embed.js <- main script embed.js <- 主脚本
  • dev2.js <- required custom script by embed.js which reads this json file dev2.js <- embed.js 需要自定义脚本,它读取这个embed.js文件
  • fred.json renamed to chartio.json fred.json重命名为chartio.json

embed.js code relevant to issue:与问题相关的embed.js代码:

var http = require('http');
var jwt = require('jwt-simple');
var dashinfo = require('./dev2');

var ORGANIZATION_SECRET = dashinfo.getkey();
var ORG_ID = dashinfo.getorgid();

dev2.js code relevant to issue:与问题相关的dev2.js代码:

var mariadb = require('mariadb');
var connectioninfo = require('./chartio.json');

module.exports = {
  getkey: function () {
    return connectioninfo.connection.apikey;
  },
  getorgid: function () {
    return connectioninfo.connection.orgid;
  },

and finally, I have my charti0.json file which I cannot post due to sensitive data.最后,我有我的charti0.json文件,由于敏感数据我无法发布。 I assure you that everything was working until I renamed fred.json to chartio.json .我向您保证,在我将chartio.json重命名为fred.json之前,一切正常。

I have looked online to see if there is a way to clear the cache but I couldn't find anything that seemed to work, though I am a novice.我在网上查看是否有清除缓存的方法,但我找不到任何似乎有效的方法,尽管我是新手。 I also looked at logs.我还看了日志。 I tried running this in IE and Chrome我尝试在 IE 和 Chrome 中运行它

This is what I see logged from the error:这是我从错误中看到的记录:

Application has thrown an uncaught exception and is terminated:


Error: Cannot find module './fred.json'
Require stack:
- C:\xxx\xxx\GPS411\node\dev2.js
- C:\xxx\xxx\GPS411\node\embed.js
- C:\Program Files (x86)\iisnode\interceptor.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (C:\Omnitracs\sylectus-trunk\GPS411\node\dev2.js:3:22)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19)

Folks, I was able to get this working by doing an old fashion workstation reboot.伙计们,我可以通过重新启动老式工作站来完成这项工作。 I changed the filename again to test if the issue returns and it seems to recognize the file changes now.我再次更改了文件名以测试问题是否再次出现,并且它现在似乎可以识别文件更改。 I guess I was just stuck in cache-land, but now I'm free.我想我只是被困在缓存区,但现在我自由了。 Thanks for your consideration.感谢您的考虑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM