0

**THE ERROR **

This issue is given below. It compiled successfully using "npx hardhat compile" but whenever i try to run it using "npx hardat run scripts/deploy.js --network rinkeby" it is showing me the error. Solution for this error is not given anywhere. Please help!!!

X:\Projects\twitter-web3\smartContracts> npx hardat run scripts/deploy.js --network rinkeby
npm ERR! 404
npm ERR! 404  'hardat@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\niken\AppData\Roaming\npm-cache\_logs\2022-05-29T15_39_19_531Z-debug.log
Install for [ 'hardat@latest' ] failed with code 1
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/hardat - Not found
npm ERR! 404
npm ERR! 404  'hardat@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\niken\AppData\Roaming\npm-cache\_logs\2022-05-29T15_41_17_035Z-debug.log
Install for [ 'hardat@latest' ] failed with code 1

THE FILES-

MintProfileImage.sol

    // SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;

    

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";

contract ProfileImageNfts is ERC721, Ownable {
    using Counters for Counters.Counter;
    using Strings for uint256;

    Counters.Counter _tokenIds;
    mapping(uint256 => string) _tokenURIs;

    struct RenderToken {
        uint256 id;
        string uri;
        string space;
    }

    constructor() ERC721("ProfileImageNfts", "PIN") {}

    function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal {
        _tokenURIs[tokenId] = _tokenURI;
    }

    function tokenURI(uint256 tokenId)
        public
        view
        virtual
        override
        returns (string memory)
    {
        require(_exists(tokenId), "URI not exist on that ID");
        string memory _RUri = _tokenURIs[tokenId];
        return _RUri;
    }

    function getAlltoken() public view returns (RenderToken[] memory) {
        uint256 latestId = _tokenIds.current();
        RenderToken[] memory res = new RenderToken[](latestId);
        for (uint256 i = 0; i <= latestId; i++) {
            if (_exists(i)) {
                string memory uri = tokenURI(i);
                res[i] = RenderToken(i, uri, " ");
            }
        }
        return res;
    }
    
    function mint(address recipents, string memory _uri)
        public
        returns (uint256)
    {
        uint256 newId = _tokenIds.current();
        _mint(recipents, newId);
        _setTokenURI(newId, _uri);
        _tokenIds.increment();
        return newId;
    }
}

Package.json

{
  "name": "hardhat-project",
  "devDependencies": {
    "@nomiclabs/hardhat-ethers": "^2.0.4",
    "@nomiclabs/hardhat-waffle": "^2.0.2",
    "chai": "^4.3.6",
    "ethereum-waffle": "^3.4.0",
    "ethers": "^5.5.4",
    "hardhat": "^2.8.3"
  },
  "dependencies": {
    "@openzeppelin/contracts": "^4.4.2"
  }
}
  • Lots of hits related to this common issue. What research have you done? See: https://stackoverflow.com/q/64589655/437212 (If your situation is unique and cannot be satisfied by other Q&A you should [edit] this question and tell us why.) –  Jun 01 '22 at 17:06
  • 1
    Does this answer your question? [Package is not publishing to npm (not in the npm registry)](https://stackoverflow.com/questions/64589655/package-is-not-publishing-to-npm-not-in-the-npm-registry) – kotatsuyaki Jun 02 '22 at 07:34

0 Answers0