简体   繁体   中英

npm list is not pointing to the node_modules folder

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM