You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行truffle init命令报错求助:无法找到original-require模块

Fixing "Cannot find module 'original-require'" Error with Truffle on Node.js 9.11.1

Hey Saurabh, sorry to hear you're hitting this snag as you dive into smart contract development. Let's work through fixing this original-require module error you're seeing when running truffle init:

First, let's recap the error you ran into for clarity:

Error: Cannot find module 'original-require' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15) at Function.Module._load (internal/modules/cjs/loader.js:475:25) at Module.require (internal/modules/cjs/loader.js:598:17) at require (internal/modules/cjs/helpers.js:11:18) at Object. (C:\Users\sau...

This issue almost always comes down to version incompatibilities between Truffle and your older Node.js 9.11.1 installation or corrupted cached files from the initial install. Here's how to fix it step by step:

Step 1: Uninstall the problematic Truffle instance

First, remove the global Truffle package that's causing the conflict:

npm uninstall -g truffle

Step 2: Clear npm's cache to eliminate corrupted files

Sometimes npm caches broken partial packages, so let's wipe that cache clean to start fresh:

npm cache clean --force

Step 3: Install a Truffle version compatible with Node.js 9.11.1

Node.js 9 is quite outdated, so newer Truffle versions won't play nice with it. Instead, install a stable older version that supports Node.js 9—Truffle v4.1.14 is a reliable, well-tested choice here:

npm install -g truffle@4.1.14

Step 4: Verify the installation and test truffle init

Once the install finishes, confirm everything is set up correctly by checking the Truffle version:

truffle version

You should see output showing Truffle v4.1.14. Now run truffle init again in your project directory—it should execute without the module error.

Extra Troubleshooting Tip (Windows Users)

If you're still stuck, try opening your command prompt as an administrator before reinstalling Truffle. Windows sometimes restricts global package installations without elevated permissions, which can lead to incomplete installs that trigger this error.

内容的提问来源于stack exchange,提问作者Saurabh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 07:34:40