NPM Cannot read property '0' of undefined

前端 未结 11 637
你的背包
你的背包 2021-01-03 17:52

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! Can         


        
相关标签:
11条回答
  • 2021-01-03 18:16

    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.

    0 讨论(0)
  • 2021-01-03 18:17

    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
    
    0 讨论(0)
  • 2021-01-03 18:19

    Seems to be an issue with a combination of factors.

    Some workarounds here:

    https://github.com/npm/npm/issues/18238

    0 讨论(0)
  • 2021-01-03 18:30

    Try with nvm(Node Version Manager).it help you to install any node version for any project without any Error.

    0 讨论(0)
  • 2021-01-03 18:34

    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

    0 讨论(0)
  • 2021-01-03 18:36

    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.

    0 讨论(0)
提交回复
热议问题