简体   繁体   中英

Npm doesn't work in node.js : cannot find module 'D:/test/*'

I am working with node.js on my local website and I want to install a module. The problem is npm doesn't seem to be working. For example, if I execute the following command npm -v , I have this :

D:\test>npm

module.js:340
    throw err;
          ^
Error: Cannot find module 'D:\test\*'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:903:3

D:\test>npm -v

module.js:340
    throw err;
          ^
Error: Cannot find module 'D:\test\*'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:903:3

I am on Windows and I followed the node.js default installation.

There can b other cases, but acc. to me, this is because the absolute path you have given in require(D:\\test*) change all paths of require to require(D:/test/*) . if this is not case u need to reinstall ur npm

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