简体   繁体   English

当我需要('node-expat')时,抛出错误:找不到绑定文件

[英]When I require('node-expat'), throw Error: Could not locate the bindings file

I need require('node-expat'), but it throw error.我需要 require('node-expat'),但它会抛出错误。 I don't know how to solve it.我不知道如何解决。 Thanks for your help.谢谢你的帮助。

Error: Could not locate the bindings file. Tried:
 → /Users/cfl/node_modules/node-expat/build/node_expat.node
 → /Users/cfl/node_modules/node-expat/build/Debug/node_expat.node
 → /Users/cfl/node_modules/node-expat/build/Release/node_expat.node
 → /Users/cfl/node_modules/node-expat/out/Debug/node_expat.node
 → /Users/cfl/node_modules/node-expat/Debug/node_expat.node
 → /Users/cfl/node_modules/node-expat/out/Release/node_expat.node
 → /Users/cfl/node_modules/node-expat/Release/node_expat.node
 → /Users/cfl/node_modules/node-expat/build/default/node_expat.node
 → /Users/cfl/node_modules/node-expat/compiled/7.5.0/darwin/x64/node_expat.node
    at bindings (/Users/cfl/node_modules/bindings/bindings.js:88:9)
    at Object.<anonymous> (/Users/cfl/node_modules/node-expat/lib/node-expat.js:4:32)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/cfl/Downloads/node-xml2json-master/lib/xml2json.js:1:75)

My problem is that the dir of 'node-expat' is not completed.我的问题是'node-expat'的目录没有完成。 Remove it and run npm install node-expat again.删除它并再次运行npm install node-expat

In my case the Node version was the real issue.就我而言,Node 版本才是真正的问题。 I downloaded the latest version of Node instead of the one that is "Recommended for Most Users".我下载了最新版本的 Node,而不是“推荐给大多数用户”的版本。 I removed the the latest version and installed the recommended one and Voila!我删除了最新版本并安装了推荐的版本,瞧!

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

相关问题 使用`node-ffi`时如何解决`错误:找不到绑定文件。`? - How can I resolve `Error: Could not locate the bindings file.` when using `node-ffi`? 错误:找不到绑定文件 better-sqlite3.node - Error: Could not locate the bindings file better-sqlite3.node 错误:无法找到绑定文件。 尝试过:(Webpack) - Error: Could not locate the bindings file. Tried: (Webpack) 错误:找不到绑定文件。 试过:(Linux) - Error: Could not locate the bindings file. Tried: (Linux) zeromq w / Electron:找不到绑定文件 - zeromq w/ Electron: Could not locate the bindings file 在Windows 7下使用electron.js时,LevelDOWN找不到绑定文件 - LevelDOWN could not locate the bindings file when using electron.js under Windows 7 在 Node 中使用 Multiparty 时,如何正确抛出错误? - When using Multiparty in Node, how do I properly throw an error? 为什么是“节点。” 当我在 cmd 中输入时总是抛出错误? - Why does 'node .' always throw an error when I type it in cmd? 当我尝试将 js 文件(带有节点模块)导入到我的主电子 js 文件时,出现“require is not defined”错误 - "require is not defined" error comes when i try to import js file (with node modules) to my main electron js file 使用require时如何找到.js文件的正确路径 - How to locate the right path for a .js file when using require
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM