ilearnio / module-alias

Register aliases of directories and custom module paths in Node
MIT License
1.76k stars 69 forks source link

404 Error with NPM #112

Open thrace19 opened 3 years ago

thrace19 commented 3 years ago
--> npm install @json/presences @utils/cleanup @utils/utils @utils/responses @utils/schema node-fetch
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@utils%2fcleanup - Not found
npm ERR! 404 
npm ERR! 404  '@utils/cleanup@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!     /home/runner/.npm/_logs/2021-02-10T14_04_48_604Z-debug.log
exit status 1

Package.json

  "_moduleAliases": {
    "@utils": "src/utils",
    "@structures": "src/structures",
    "@json": "assets/json",
    "@languages": "src/languages"
  }

I also tried in my index file

const moduleAlias = require("module-alias");

moduleAlias.addAliases({
  "@utils":   __dirname + "/src/utils",
  "@structures": __dirname + "/src/structures",
  "@json":  __dirname + "/assets/json",
  "@languages": __dirname + "/src/languages"
});
Kehrlann commented 3 years ago

Hi 👋 I'm not sure I understand that npm install... Why is it trying to install from your sources? If I understand correctly, these files are local to your project, they don't need to be npm install'ed. node-fetch makes sense but the rest, I'm not sure.

Could you please share the full package.json ?

thrace19 commented 3 years ago
{
  "name": "princess",
  "version": "2.0.1",
  "description": "lel",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "inhydrox",
  "license": "Apache 2.0",
  "dependencies": {
    "@top-gg/sdk": "^3.0.7",
    "axios": "^0.21.1",
    "canvas": "^2.6.1",
    "canvas-constructor": "^4.1.0",
    "cheerio": "^1.0.0-rc.3",
    "dblapi.js": "^2.4.0",
    "discord.js": "^12.2.0",
    "dotenv": "^8.2.0",
    "fast-levenshtein": "^2.0.6",
    "image-size": "^0.9.1",
    "img-api": "^1.0.4",
    "module-alias": "^2.2.2",
    "moment": "^2.28.0",
    "moment-timezone": "^0.5.31",
    "mongodb": "^3.6.0",
    "ms": "^2.1.2"
  },
  "_moduleAliases": {
    "@utils": "src/utils",
    "@structures": "src/structures",
    "@json": "assets/json",
    "@languages": "src/languages"
  }
}
Kehrlann commented 3 years ago

This is surprising to me. Where does this npm install @json/presences @utils/cleanup @utils/utils @utils/responses @utils/schema node-fetch come from ? You don't have node-fetch in your dependencies, or any of the @utils etc.

Is this happening locally ? Which command are you running when this happens ?

thrace19 commented 3 years ago

It's only happening on repl.it it's working fine locally