Skip to content

Instantly share code, notes, and snippets.

@joannecheng
Last active May 19, 2016 12:47
Show Gist options
  • Save joannecheng/f7fe51d162b5b2fd843d to your computer and use it in GitHub Desktop.
Save joannecheng/f7fe51d162b5b2fd843d to your computer and use it in GitHub Desktop.
npm issue?
{
"name": "npm-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"lodash": "^3.10.1",
"rquery": "^2.0.8"
}
}
  1. Create a folder called npm-test and place package.json in there.
  2. cd npm-test
  3. npm install
  4. ls node_modules. Observe that lodash and rquery folders are there.
  5. Open package.json, change rquery version from ^2.0.8 to ^3.1.1.
  6. run npm install to update packages.
  7. Observe that this line gets printed out after running npm install: lodash@3.10.1 node_modules/lodash -> node_modules/rquery/node_modules/lodash
  8. ls node_modules. Observe that lodash is no longer there. This makes any code in the project that runs require('lodash') break. (ex: node test.js using the test.js file in this gist)
  9. Run npm install again, look at node_modules and observe that lodash is back there.
/* run `node test.js` */
require('lodash')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment