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.
Seems to be an issue with a combination of factors.
Some workarounds here:
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
For me (npm@6.9.0) solved the issue by deleting node_modules and performing npm install, but without removing package.json.lock file.
Try with nvm(Node Version Manager).it help you to install any node version for any project without any Error.
I bumped into this issue using nvs (Node Version Switcher - https://github.com/jasongin/nvs) node@10.15.3 and npm@6.9.0. The reason was a local package I had linked with npm link. The solution was to remove that folder.
In my case reinstalling node_modules have not fixed this issue.
Problem was with one *.ts file which was missing in source codes.
Do not know why It was not displaying compilation error, but adding this missing file to repository solved this issue.
Just remove both node_modules and package-lock.json and run: npm install
or
Just run: npm install -g npm@latest to upgrade it to the latest version
What worked for me:
npm ci
Install a project with a clean slate docs: https://docs.npmjs.com/cli/v7/commands/npm-ci
Deletes node_modules and installs everything based on package-lock.json, so no need to regenerate that