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

VS2017是否支持Solidity?Win10安装步骤及truffle.js报错咨询

Hey there! Let's break down your questions and fix that error step by step:

Visual Studio 2017 & Solidity: Support, Installation Steps, and Error Fix

Does Visual Studio 2017 Support Solidity?

Absolutely! Visual Studio 2017 does support Solidity development, but you’ll need to install a dedicated extension to add syntax highlighting, IntelliSense, and other Solidity-specific tools. The most reliable extension is the Solidity for Visual Studio package (maintained by community contributors and compatible with VS2017).

Windows 10: Step-by-Step Solidity Setup for VS2017

Follow these steps to get Solidity up and running in your VS2017 environment:

  1. Update Visual Studio 2017 First

    • Open VS2017, go to Tools > Get Tools and Features.
    • Ensure the Node.js Development workload is installed (this helps with tools like Truffle later). If it’s missing, check the box and click Modify to install it.
  2. Install the Solidity Extension

    • In VS2017, navigate to Tools > Extensions and Updates.
    • Switch to the Online tab, search for Solidity in the search bar.
    • Pick the top-rated extension (usually just named "Solidity") and click Download. Restart VS2017 once the download finishes to complete installation.
  3. Set Up the Solidity Compiler (solc)

    • If you don’t have Node.js installed, grab version 12+ (Truffle works best with this range) from the official Node.js site.
    • Open an elevated Command Prompt (right-click > Run as administrator) and run:
      npm install -g solc
      
    • Verify the installation by running solc --version in the command line—you should see the compiler version printed.
  4. Optional: Install Truffle Framework (for DApp Development)

    • If you’re building decentralized applications, install Truffle via npm:
      npm install -g truffle
      
    • Initialize a new Truffle project in your desired folder:
      mkdir MySolidityDApp
      cd MySolidityDApp
      truffle init
      

Fixing the 'module' is undefined JScript Runtime Error

That error happens because Windows is trying to run your truffle.js file with Microsoft JScript (the default handler for .js files) instead of Node.js. Here’s how to fix it:

  1. Set Node.js as the Default Handler for .js Files

    • Right-click any .js file on your system, select Open with > Choose another app.
    • Select Node.js from the list (if it’s not visible, click More apps and navigate to your Node.js installation folder—usually C:\Program Files\nodejs\node.exe).
    • Check the box "Always use this app to open .js files" and click OK.
  2. Verify the Fix

    • Open Command Prompt, navigate to your Truffle project folder, and run:
      truffle compile
      
    • The error should disappear, as Node.js will now properly execute the .js configuration files.
  3. Alternative: Run Truffle Explicitly via Node.js

    • If you don’t want to change default file handlers, you can run Truffle directly using Node.js:
      node C:\Users\<YourUsername>\AppData\Roaming\npm\node_modules\truffle\build\cli.bat compile
      
    • Replace <YourUsername> with your actual Windows username.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.15 04:51:39