If you're getting npm: command not found, Node.js and npm are not installed or not in your PATH.
- Go to: https://nodejs.org/
- Download: LTS version (v20.x or v18.x recommended)
- Install: Run the installer
- Verify: Open a new terminal and run:
node --version npm --version
If you have Chocolatey installed:
choco install nodejswinget install OpenJS.NodeJS.LTSClose your current terminal and open a new one so PATH updates take effect.
node --version
npm --versionYou should see version numbers like:
v20.11.0
10.2.4
Navigate to your project directory:
cd C:\Users\sanas\OneDrive\Desktop\FlaredUpHackThen install dependencies:
npm installThis will:
- Read
package.json - Install all dependencies
- Create
node_modules/folder - Create
package-lock.json
Check if Hardhat is installed:
npm list hardhat
npm list @nomicfoundation/hardhat-toolboxWhen npm install runs successfully, you'll see:
added 1234 packages, and audited 1235 packages in 2m
-
Restart your computer - Sometimes PATH updates need a full restart
-
Check PATH manually:
$env:PATHShould include:
C:\Program Files\nodejs\ -
Add to PATH manually (if needed):
- Open System Properties → Environment Variables
- Add
C:\Program Files\nodejs\to PATH - Restart terminal
-
Clear npm cache:
npm cache clean --force
-
Delete node_modules and reinstall:
Remove-Item -Recurse -Force node_modules -ErrorAction SilentlyContinue Remove-Item -Force package-lock.json -ErrorAction SilentlyContinue npm install
- Node.js installed (v18+)
- Terminal restarted after Node.js installation
-
node --versionworks -
npm --versionworks - In project directory:
C:\Users\sanas\OneDrive\Desktop\FlaredUpHack - Run
npm install - Dependencies installed successfully
Once dependencies are installed:
-
Compile contracts:
npm run compile
-
Run tests:
npm run test:smartaccount
Install Node.js first, then run npm install in your project directory!