简体   繁体   中英

Why am I getting a "Cannot read property 'length' of undefined" error when I try to install React-Bootstrap using "npm i react-bootstrap"?

I'm following a full-stack MERN tutorial, and after using the "npx create-react-app" command to create the react application smoothly, everything is compiling & running properly, but as SOON AS I try to install the React-Bootstrap library using the regular "npm i react-bootstrap" in the command line of Visual Studio Code OR Windows CMD, I'm getting the "Cannot read property 'length' of undefined". Could somebody PLEASE explain how to get rid of that error so that I can install React-Bootstrap? I'm unable to proceed further, and I would really appreciate if someone could help me out!

So one of the users in the comments suggested installing the "LTS" version of Node.js, instead of the one that's shown with "latest features" on their website. And indeed, installing the LTS version of Node.js fixed the problem, I don't understand though, how literally. an updated version of Node.js with "latest features" could throw errors/get stuck on installing libraries via npm, Regardless. this particular issue has now been resolved.

Updating Node using nvm install --lts solved it for me and I was able to install the package.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM