Name Can Only Contain Url-Friendly Characters

I was trying to install package.json with npm init to install bootstrap in my folder but i am getting the error.

npm install [email protected] --save

I am new to this i can't exactly figure what i am doing wrong. I was following a tutorial whose link i'll attach along with screenshot of my console.

this the tutorial link

2

9 Answers

npm init is actually creating the package.json file and setting the characteristics of the project(It has no relation with bootstrap). So, in the field package name, you have to enter the name of your project (you have now entered the npm install bootstrap command) or you can just press enter if the name displayed in bracket is enough. Complete the npm init processs by setting all characteristics of project.

As next step, you can do npm install [email protected] --save. It'll work

3

Deleting the lock-file and running npm i again solved the issue for me.

I was getting the same problem but I changed package-name first name was like:

My Folder Name

I changed it to

my-folder-name

with no spaces & no capital letters. It solved the problem for me. Happy coding

0

Just hit enter and cycle through all the options. You don't type in the npm install until after you have finished init.

Not only DELETE package-lock.json in main folder but also find (whit this command find node_modules/ -iname *-lock*) and delete all '-lock' files in node_modules then run npm install again.

Make sure you are typing in the right place, npm init and then hit enter/return a few times until you are at a prompt starting with C:\Users if you are in Windows.

I also encountered the same problem when installing sass, because I watched some tutorials on YT where they instructed to use Live Sass Compiler, so I had to change some settings for saving the file. Then I uninstalled it, go through the traditional process of

npm init
npm install node-sass --save-dev
npm run compile:sass 

and .....BAMMMM!!!! It worked

1

Press a few enter that will help you get out of npm init. then type the npm install comment. This worked for me.

I was also facing the same issue while installing the json-server ...but got resolved actually the problem is not with the folder name....so, there is two way to sort this problem one by ---- after npm init press 5-8 times enter or u can directly use (npm init -y) both will work fine Happy coding

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Marcus Vance

Marcus Vance

Cybersecurity & Digital Privacy Researcher

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.

Share this article
Twitter Facebook Pinterest