npm doesn't work for me because of wrong config - javascript

When I want to use the npm package manager for js we package or project like this command:
npm start
It shows me :
npm ERR! code E418
npm ERR! 418 Unknown - GET https://repo.huaweicloud.com/repository/npm/yarn
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Amir\AppData\Local\npm-cache\_logs\2021-12-08T13_04_36_000Z-debug.log
I think my npm mirror is wrong, how can I fix it?

You can use
npm config --global edit
and
npm config edit, it will open the npm config with your default editor.
and then remove the registry line for each file to reset it to defaults.

Related

I encountered a problem when installing Next JS

I was installing NextJS when I encountered the following error:
D:\Codes\React\Learn>npx create-next-app
npm WARN using --force Recommended protections disabled.
npm WARN using --force Recommended protections disabled.
npm ERR! code E404
npm ERR! 404 File Not Found - GET https://skimdb.npmjs.com/registry/create-next-app
npm ERR! 404
npm ERR! 404 'create-next-app#latest' is not in this 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\User\AppData\Local\npm-cache\_logs\2023-02-06T12_41_40_938Z-debug-0.log
Can anyone help me?
I wanted to work with NextJS......but I encountered this error!
You should give directory address in the installation command ,
Try : npx create-next-app#latest . if you want to install the packages in current directory or
npx create-next-app#latest YOUR_FOLDER_NAME and packages will be installed in new folder with the given name as YOUR_FOLDER_NAME.
Try this:
npm i -g create-next-app
It will install create next app globally. To create a next app run this command, if you want to install in current folder.
npx create-next-app
Otherwise, specify the folder name like,
npx create-next-app [your app name]

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

I was watching a tutorial on sass and I got stuck in this part , im not familiar with npm,nodejs and stuff so idk what i should do !? can u take a look and see why i cant install node-sass?
PS D:\NODE-SASS> npm install node-sass
npm ERR! code ENOSELF
npm ERR! Refusing to install package with name "node-sass" under anpm ERR! also called "node-sass". Did you name your project the same
npm ERR! as the dependency you're installing?
npm ERR!
npm ERR! For more information, see:
npm ERR! <https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm>
npm ERR! A complete log of this run can be found in:
npm ERR! C:\bla blabla_25_42_696Z-debug.log
PS D:\NODE-SASS> npm install node-sass
npm ERR! code ENOSELF
npm ERR! Refusing to install package with name "node-sass" under a package
npm ERR! also called "node-sass". Did you name your project the same
npm ERR! as the dependency you're installing?
npm ERR!
npm ERR! For more information, see:
npm ERR! <https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm>
npm ERR! A complete log of this run can be found in:
npm ERR! c:/bla bla bla
This text clearly states that you gave the same name to your project in package.json as the name of this package.
also called "node-sass". Did you name your project the same
npm ERR! as the dependency you're installing?
Rename your project in package.json and maybe a folder itself not to confuse it with this package
You should rename your project name in package.json file and try again. install package that you want to install. All of them must be OK

npm start throwing error 'This is related to npm not being able to find a file.'

I just created a react app, it was working fine but once I restart the editor it is throwing error like this :
Poojas-MacBook-Air:newreact pooja$ npm start
npm ERR! path /Users/pooja/Desktop/projects/newreact/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open
'/Users/pooja/Desktop/projects/newreact/package.json'
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! /Users/pooja/.npm/_logs/2020-11-28T10_27_42_118Z-debug.log
Please help if anyone knows about it.
Make sure you have the latest npm (npm install -g npm).
Add an exception to your antivirus to ignore the node_modules folder in your project.
rm -rf node_modules package-lock.json
npm install
Sometimes the PATH is not correct, just open the cmd and cd to the address where the package.json is and then run npm start
For me, it was because of the running Metro server. If anyone is experiencing this issue in react-native, make sure you have stopped the running Metro server instance before entering npm i <package-name>.
With yarn, I think, there's no such issue.
To resolve package.json file, go to your project folder and find package.json location folder.
Open terminal and make sure your are in correct path where package.json file located.
eg: c://projectfolder/folder1/clientapp> npm start

Can not run React App after cloning it from Github

I really need your help. I would be highly appreciated.
I clone this project : https://github.com/iearn-finance/iearn-finance,
and I want to have a front-end website like this: https://yearn.finance/.
But I can not run it locally. I have tried "npm install" and then "npm start", check package.json carefully but it still does not work and gave me this error:
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path D:\iearn-finance-develop\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'D:\iearn-finance-develop\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
1- are you sure path D:\iearn-finance-develop is correct??
isn't D:\iearn-finance ??
2-did you :
delete package-lock.json and node_modules and then npm install
3-check on your filesystem if the file exists.
try these :
npm cache clean
you should initialize package with :
npm init
then install your packages
Try cleaning the cache with npm cache clean
Then initialize with npm init
After that, install your packages.
It worked for mine.

Having Issues with npm

npm ERR! missing script: start
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Earnest\AppData\Roaming\npm-cache\_logs\2020-06->05T12_21_01_507Z-debug.log
and the Script is there.
I'm using Windows 10.
You're trying to run the command npm start
where as in your package.json, it is missing. Trying putting this in your package.json
"scripts” :{ “start” : ...}

Categories

Resources