After updated Node (upto v8.6.0) and npm (upto v5.5.1) I cannot execute command npm install
.
After npm install I've error message:
npm ERR! Cannot read property '0' of undefined
What's trouble or I need downgrade node/npm ?
After updated Node (upto v8.6.0) and npm (upto v5.5.1) I cannot execute command npm install
.
After npm install I've error message:
npm ERR! Cannot read property '0' of undefined
What's trouble or I need downgrade node/npm ?
I had the same problem.
I removed both node_modules and package-lock.json and then did:
npm install
And it worked.
Edit by @OwlyMoly
Due to new updates and the restriction to old dependencies in package-lock.json is causing this conflicts. By doing npm install
won't fix this issue. Instead by ditching npm_modules and package-lock.json and doing npm install
will load a new node_modules and that supposed to be required by package.json. You have to commit the new package-lock.json along with your latest changes of the project.
Do 2 steps bellow (Window):
rm -rf ./node_modules
to remove node folder
rm package-lock.json
to remove package-lock.json
file
then npm install
to re-install the node modules
nodejs@8.6.0 npm@5.5.1 - I have trouble and the test fails
nvm use 8.5.0
nodejs@8.5.0 npm@5.5.1 - I have trouble and the test fails
nvm use 8.4.0
nodejs@8.4.0 npm@5.5.1 - I have trouble and the test fails
npm install npm@^5 -g
nodejs@8.4.0 npm@5.4.2 - I have trouble and the test fails
nvm use 8.6.0
npm install npm@^4 -g
nodejs@8.6.0 npm@4.6.1 - no trouble, this fixes it.
Deleting package.json.lock
file and node_modules
folder, unfortuntely didn't help in my case.
Just download and install latest Yarn which is also a node package manager, developed by facebook, but has a much better dependency management. Also update your node cli (optional).
And then, install your dependencies using yarn
:
yarn install
or
yarn // short version of yarn install
No errors!
You can continue to use npm
after you have installed all dependencies with yarn
or continue with yarn
....it's your choice.
Seems to be an issue with a combination of factors.
Some workarounds here:
https://github.com/npm/npm/issues/18238
npm 5.3.0 is broken for windows 10 after upgrading the nodeJS.
You should downgrade the npm, it is a temporary solution but works fine.
npm install -g npm@5.2.0
Try with nvm(Node Version Manager).it help you to install any node version for any project without any Error.
I found same problem when using npm version 5.5.1 to install babel-preset-stage-0
Solution: I downgraded npm to version 5.2.0 and try to install again then it can solve the issue.
npm i -g npm@5.2.0
npm i -D babel-preset-stage-0