Search code examples
smartcontractstruffle

windows 10 - npm i @truffle/contract


Can't install truffle contracts, see Error 1.

ERROR 1:

C:\Vote>npm i @truffle/contract

npm ERR! code ENOENT

npm ERR! syscall spawn git

npm ERR! path git

npm ERR! errno ENOENT

npm ERR! enoent Error while executing:

npm ERR! enoent undefined ls-remote -h -t ssh://[email protected]/web3 js/WebSocket-Node.git

npm ERR! enoent

npm ERR! enoent

npm ERR! enoent spawn git ENOENT

npm ERR! enoent This is related to npm not being able to find a file.

npm ERR! enoent

npm ERR! A complete log of this run can be found in:

npm ERR! C:\Users\laure\AppData\Roaming\npm-cache_logs\2019-11-11T03_41_13_180Z-debug.log

I think Error 2, happens because I haven't installed truffle contract also Error 2 happens on a local web page.

ERROR 2:

Uncaught (in promise) ReferenceError: TruffleContract is not defined

at Object.loadContract (app.js:56)

at async Object.load (app.js:8)


Solution

  • The give away is this line in your error log:

    npm ERR! enoent spawn git ENOENT
    

    Basically, it means that the command git was not found and thus can not be executed.

    Make sure you have installed git and added it to your environment PATH before running this install command again.