npm install not installing latest version on GitHub

后端 未结 2 1141
予麋鹿
予麋鹿 2021-01-31 15:25

I have a module called \'sails-mongo\' and I want to update it to the newest version using the following command:

npm update sails-mongo --save

2条回答
  •  遥遥无期
    2021-01-31 16:13

    I had a similar issue. Via the NPM Registry I was trying to get the latest from a project I saw in in GitHub, like this:

    //package.json
    "devDependencies": {
        "foo-package": "^3.3.0",
    }
    

    But the code I got back from npm install (as observed in the node_modules/ folder) was not what I saw in GitHub repository's master branch. I was confused; as the two didn't match.

    I eventually found: https://docs.npmjs.com/cli/view, which reveals some information (versions and dates) of what the NPM Registry is aware of for a particular repository.

    // Console example
    npm view foo-package
    

    After confirming that what I wanted from GitHub repository's master branch wasn't in the NPM Registry, I eventually changed my approach Git URLs as Dependencies, just as @apsillers answers.

提交回复
热议问题