简体   繁体   English

VS代码:模块未自注册(node-expat)

[英]VS Code: Module did not self register (node-expat)

I have upgraded my version of Nodejs and npm, and after doing this I'm receiving the following error when running my nodejs application: 我已经升级了Nodejs和npm的版本,执行此操作后,在运行nodejs应用程序时收到以下错误:

在此处输入图片说明

I saw a tons of post regarding this issue, and I tried everything exposed there like these ones: 我看到了关于此问题的大量帖子,并且尝试了所有暴露于此类问题的内容:

1) Uncaught Error: Module did not self-register 1) 未捕获的错误:模块未自注册

2) Error: Module did not self-register" running first example of main github page (Node 0.11.13) 2) 错误:“模块未自注册”正在运行github主页(节点0.11.13)的第一个示例

By executing a " npm rebuid " I see the following output in console: 通过执行“ npm rebuid ”,我在控制台中看到以下输出:

在此处输入图片说明

As my understanding, seems to be a problem with the " node-expat " module, which I suspect that is coming from "xml2json" library. 据我了解,“ node-expat ”模块似乎存在问题,我怀疑它来自“ xml2json”库。 Any thougts? 有什么想法吗?


EDIT 1: 编辑1:

I tried to do a re-install of node-expat, by running " npm install node-expat " as ADMINISTRATOR, and by looking at the log I see the following: 我尝试通过以管理员身份运行“ npm install node-expat ”来重新安装node-expat ,并通过查看日志看到以下内容:

48 warn kissArteNode@1.0.0 No repository field.
49 verbose stack Error: EPERM: operation not permitted, unlink 'C:\Projects\APP002-01\src\arte\AON.PhoenixRuleEngine.Arte\NodeJs\node_modules\.node-expat.DELETE\build\Release\node_expat.node'
49 verbose stack     at Error (native)
50 verbose cwd C:\Projects\APP002-01\src\arte\AON.PhoenixRuleEngine.Arte\NodeJs
51 verbose Windows_NT 6.1.7601
52 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\a0717016\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "node-expat"
53 verbose node v6.11.0
54 verbose npm  v5.6.0
55 error path C:\Projects\APP002-01\src\arte\AON.PhoenixRuleEngine.Arte\NodeJs\node_modules\.node-expat.DELETE\build\Release\node_expat.node
56 error code EPERM
57 error errno -4048
58 error syscall unlink
59 error Error: EPERM: operation not permitted, unlink 'C:\Projects\APP002-01\src\arte\AON.PhoenixRuleEngine.Arte\NodeJs\node_modules\.node-expat.DELETE\build\Release\node_expat.node'
59 error     at Error (native)
59 error  { Error: EPERM: operation not permitted, unlink 'C:\Projects\APP002-01\src\arte\AON.PhoenixRuleEngine.Arte\NodeJs\node_modules\.node-expat.DELETE\build\Release\node_expat.node'
59 error     at Error (native)
59 error   cause:
59 error    { Error: EPERM: operation not permitted, unlink 'C:\Projects\APP002-01\src\arte\AON.PhoenixRuleEngine.Arte\NodeJs\node_modules\.node-expat.DELETE\build\Release\node_expat.node'
59 error        at Error (native)
59 error      errno: -4048,
59 error      code: 'EPERM',
59 error      syscall: 'unlink',
59 error      path: 'C:\\Projects\\APP002-01\\src\\arte\\AON.PhoenixRuleEngine.Arte\\NodeJs\\node_modules\\.node-expat.DELETE\\build\\Release\\node_expat.node' },
59 error   stack: 'Error: EPERM: operation not permitted, unlink \'C:\\Projects\\APP002-01\\src\\arte\\AON.PhoenixRuleEngine.Arte\\NodeJs\\node_modules\\.node-expat.DELETE\\build\\Release\\node_expat.node\'\n    at Error (native)',
59 error   errno: -4048,
59 error   code: 'EPERM',
59 error   syscall: 'unlink',
59 error   path: 'C:\\Projects\\APP002-01\\src\\arte\\AON.PhoenixRuleEngine.Arte\\NodeJs\\node_modules\\.node-expat.DELETE\\build\\Release\\node_expat.node',
59 error   parent: 'kissArteNode' }
60 error Please try running this command again as root/Administrator.
61 verbose exit [ -4048, true ]

Why is requesting on running as admin again? 为什么要求再次以管理员身份运行?


I'm facing exactly the same issue that this post: vscode on Windows 10: Activating extension … failed: Module did not self-register 我面临着与该帖子完全相同的问题: Windows 10上的vscode:激活扩展…失败:模块未自注册

The issue seems to be more related with VS Code rather than npm and nodejs. 这个问题似乎与VS Code更相关,而不是npm和nodejs。

In my case, was enough to delete the " .vscode " folder that contains the " launch.json " file. 在我而言,就足以删除包含“launch.json”文件中的“.vscode”文件夹中。 For some reason, I believe that the configured port on debug mode, was conflicting with some other application and that prevented to load the "node-expat" module properly. 出于某种原因,我认为在调试模式下配置的端口与某些其他应用程序冲突,并且导致无法正确加载“ node-expat”模块。 It had nothing to do with Nodejs and npm as I suspected. 我怀疑它与Node.js和npm无关。

在此处输入图片说明

I was also facing the same issue on linux rhel 7, see if it works for you too, what I found out was that I needed to install gcc libraries on my instance, so I went ahead and removed my node_modules folder and then ran the sudo yum group install "Development Tools" , and I then ran the npm install again and it worked! 我在linux rhel 7上也遇到了同样的问题,看看它是否也适用于我,我发现我需要在实例上安装gcc库,因此我继续删除了node_modules文件夹,然后运行sudo yum group install "Development Tools" ,然后我再次运行npm install并成功了!

Also, there is a dependency on python, so if the above step doesn't resolve this, you may want to install python too. 另外,对python也有依赖性,因此,如果上述步骤不能解决该问题,您可能也要安装python。

Hope this helps, for issues related to installing gcc libraries and Development tools, one can refer to this url also: Install gcc and dev tools 希望这对您有帮助,因为与安装gcc库和开发工具有关的问题,还可以参考以下网址: 安装gcc和dev工具

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

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