0

I have recently install nvm, node and npm. I cant seem to get the $npm list to list the modules in the node_modules folder. Other npm commands work. npm install -g installs in the correct folder which I can see by cd'ing to it. I cant figure out why one npm command works but the next doesnt. npm config shows cwd as a different folder. Do I have to change that? If so, how do i do that? Thank you.

https://gist.github.com/kaona/0d5ba467cff814dbb1691a083baa1dee

I also tried this but didnt work. I know its something simple im missing. Still new to this. Thanks.

armand
  • 693
  • 9
  • 29

1 Answers1

1

Have you included the modules in your package.json file? The npm list command won't show a module if its not in the package.json, even if its installed in the node_modules directory.

The tree shown is the logical dependency tree, based on package dependencies, not the physical layout of your node_modules folder.

https://docs.npmjs.com/cli/ls

When you install a module into your app, use the --save or --save-dev options to update your package.json. This allows you to install all the dependencies of your application by running npm install. It will also mean that your modules show up when you use the npm list command.

https://docs.npmjs.com/cli/install - For more details

Robbie
  • 18,750
  • 4
  • 41
  • 45
  • ok, so i must use npm ls -g for globally installed modules. That's good to note. Thank you. As i just installed nvm, i went ahead and removed nvm and npm per advice [here](https://andyj.github.io/posts/npm-not-found-with-nvm.html) & [here](http://stackoverflow.com/questions/33874049/npm-not-found-when-using-nvm). Now, in project, i'm getting -bash: webpack: command not found. Which tells me npm is not in my path. I tried `My-MacBook-Pro:~ klik$ echo $(npm config get prefix)/bin. /usr/local/bin. My-MacBook-Pro:~ klik$ export PATH=$PATH:/usr/local/bin.' restarted. no joy. Is this diff in NVM? – armand May 15 '16 at 23:00
  • thanks for the help. That got me to the next problem which i worked out. Much appreciated. – armand May 16 '16 at 00:31