简体   繁体   中英

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:

在此处输入图片说明

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

2) Error: Module did not self-register" running first example of main github page (Node 0.11.13)

By executing a " npm rebuid " I see the following output in console:

在此处输入图片说明

As my understanding, seems to be a problem with the " node-expat " module, which I suspect that is coming from "xml2json" library. Any thougts?


EDIT 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:

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

The issue seems to be more related with VS Code rather than npm and nodejs.

In my case, was enough to delete the " .vscode " folder that contains the " launch.json " file. 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. It had nothing to do with Nodejs and npm as I suspected.

在此处输入图片说明

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!

Also, there is a dependency on python, so if the above step doesn't resolve this, you may want to install python too.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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