unable to configure package in npm: authorization is mandatory

After cloning a fullstack MERN (Typescript) project from GitHub, I encountered numerous errors in the code within VS code. It seemed like packages were missing or not installed properly. Whenever I tried to install them using commands like (npm install express), I kept receiving error messages like:

npm WARN idealTree Removing dependencies.@types/node in favor of devDependencies.@types/node
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@designed-and-developed%2feslint-config-prettier-typescript-react - Not found
npm ERR! 404 
npm ERR! 404  '@designed-and-developed/eslint-config-prettier-typescript-react@^1.0.9' is not in this registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
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:

Upon researching, I discovered that these errors might be related to having an npm account and signing into it. However, I prefer running the website locally without dealing with these package installation issues. How can I resolve this?

Here is my package.json file for reference:

{
  "name": "lofi-env",
  "version": "1.0.0",
  "main": "index.js",
  "repository": "https://github.com/ni-xon/lofi-env.git",
  "author": "ni-xon <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="83edeafbecedf6e0ebdcc3ecf6f7efecece8ade0ecee">[email protected]</a>>",
  "license": "MIT",
  "scripts": {
    "server": "nodemon --config nodemon.json backend/server.ts",
    "client": "yarn --cwd frontend start",
    "start": "yarn server",
    "dev": "concurrently \"yarn server\" \"yarn client\"",
    "heroku-postbuild": "cd frontend && npm install && npm run build"
  },
  "devDependencies": {
    "@designed-and-developed/eslint-config-prettier-typescript-react": "^1.0.9",
    "eslint": "^8.10.0",
    "prettier": "^2.5.1"
  },
  "dependencies": {
    "@types/bcrypt": "^5.0.0",
    "@types/express": "^4.17.13",
    "@types/jsonwebtoken": "^8.5.8",
    "@types/mongoose": "^5.11.97",
    "@types/node": "^17.0.21",
    "bcrypt": "^5.0.1",
    "concurrently": "^7.0.0",
    "dotenv": "^16.0.0",
    "express": "^4.17.3",
    "express-async-handler": "^1.2.0",
    "jsonwebtoken": "^8.5.1",
    "mongoose": "^6.2.4",
    "nodemon": "^2.0.15",
    "ts-node": "^10.7.0",
    "typescript": "^4.6.2"
  }
}

The NPM command still triggers the same error message regardless of how I call it (even when running NPM install!). Any guidance on fixing this would be greatly appreciated.

Thank you.

Answer №1

Please check your .npmrc file:

registry=https://registry.yarnpkg.com/
@designed-and-developed:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${NPM_TOKEN}
always-auth=true

If you don't have an NPM Token, you won't be able to authenticate with Github Packages to retrieve your package. Get one, insert it into the braces, and try again :)

Cheers

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

A guide to implementing angularjs app.service and $q in typescript

I am fairly new to TypeScript and AngularJS and I am struggling to find the correct answer for my issue. Below is the relevant code snippet: export class SidenavController { static $inject = ['$scope', '$mdSidenav']; constructor(p ...

Error TS2339: The specified property is not found within the given type of 'IntrinsicAttributes & IntrinsicClassAttributes<FormInstance<{}, Partial<ConfigProps<{}, {}>>>> & ...'

Recently diving into the world of TypeScript and Redux, I've been tackling the SimpleForm example from redux-form. Below is the form component I'm working with: import * as React from 'react'; import {Field, reduxForm} from 'redu ...

`npm postinstall` command does not support the `ln -s` command

I'm interested in setting up a symbolic link in my package.json: "postinstall":"ln -s ../../dist foo/dist" but unfortunately, the symbolic link does not seem to be created. The command runs smoothly in the terminal. Should I consider using a termi ...

Navigate to the logout page automatically when closing the final tab

In order to comply with the requirement, I need to log out the user when they close the last tab on the browser. ngOnInit() { let counter: any = this.cookieService.get('screenCounterCookie'); counter ? ++counter : (counter = & ...

"How can I extract father's details by clicking on a button

After clicking, I need to access the parent element. Here is the HTML code I have: <button mat-icon-button (click)="download($event)"> The generated HTML code is as follows: <button _ngcontent-wsc-c153="" mat-icon-button=&q ...

Can the output type of a function be dynamically determined by using the function parameter name as the property in an interface?

I am attempting to dynamically assign the output of a function based on the name of the input parameter within an existing interface: interface MyInterface { typeA: string; typeB: boolean; typeC: string; typeD: number; ... } const myFunction: ( ...

Locate and embed within a sophisticated JSON structure

I have an object structured as follows: interface Employee { id: number; name: string; parentid: number; level: string; children?: Employee[]; } const Data: Employee[] = [ { id:1, name: 'name1', parentid:0, level: 'L1', children: [ ...

Troubleshooting problems when installing Angular and puppeteer

Recently, I started a fresh angular project with the goal of scraping data from a website and displaying it on my page. To achieve this, I thought of simply installing puppeteer via NPM after creating a new project. However, the compiler threw various erro ...

Having trouble creating a unit test for exporting to CSV in Angular

Attempting to create a unit test case for the export-to-csv library within an Angular project. Encountering an error where generateCsv is not being called. Despite seeing the code executed in the coverage report, the function is not triggered. Below is the ...

`transpilePackages` in Next.js causing Webpack issue when used with Styled Components

I'm encountering an issue while utilizing components from a custom UI library in a repository. Both the repository and the web app share the same stack (React, Typescript, Styled Components) with Next.js being used for the web app. Upon running npm ru ...

A guide on crafting a type definition for the action parameter in the React useReducer hook with Typescript

In this scenario, let's consider the definition of userReducer as follows: function userReducer(state: string, action: UserAction): string { switch (action.type) { case "LOGIN": return action.username; case "LOGOUT": return ""; ...

Steps for transforming a regular string into a template string

Consider the following scenario: var data = '{"message": "`${message}`"}'; var obj = JSON.parse(data); var templateValue = obj.message; //`${message}` var message = 'hello'; What is the best way to evaluate the ...

Trigger an error in TypeScript with an embedded inner error

Is it possible to throw an Error with an inner Error in TypeScript, similar to how it's done in C#? In C#, you can achieve this by catching the exception and throwing a new one with the original exception as its inner exception: try { var a = 3; ...

Having trouble with a 404 error on form submission with React and Express?

I am currently working on a basic MERN application. My goal is to establish a connection between the front and back ends in order to post data on the server upon form submission. While I can access the server URL directly, I encounter a 404 error (Not Foun ...

Troubleshooting Node.js import module errors

I have just discovered two files that I created using the TS language specification manual (on page 111). The first file, called geometry.ts, contains the following code: export interface Point { x: number; y: number }; export function point(x: number, y ...

Can anyone tell me the location of my globally installed packages?

I've successfully installed TypeScript using the following command. npm install -g typescript After being informed that the version was outdated, I referred to this helpful guide to update to the latest release with this command. npm install -g ...

Activate Angular Material's autocomplete feature once the user has entered three characters

My goal is to implement an Angular Material Autocomplete feature that only triggers after the user has inputted at least three characters. Currently, I have it set up so that every click in the input field prompts an API call and fetches all the data, whic ...

Running RXJS Functions in a Sequence Maintained by an Array

I am trying to run a series of functions in sequence by storing them in an array (specifically for an Angular APP_INITIALIZER function). Here is the array in question: const obsArray = [ myService1.init(), myService2.init(), ... myServiceN ...

Can you explain the purpose of CLOUDINARY_DEFAULT_URL and CLOUDINARY_DEFAULT_PUBLICID to me?

Need help with my user sign up page Here is my .env file This is my signup controller code: const User = require('../model/User'); const bcrypt = require('bcrypt'); const { uploadToCloudinary } = require('../utils/cloudinary&apos ...

I aim to showcase div elements based on the specific Props value

My goal is to showcase the 'selected' option when the values consist of { query: string; isSelect: boolean } and the isSelect property is set to true. Error: The 'isSelect' property is not recognized in the type '{ query: string; ...