简体   繁体   English

Npm在node.js中不起作用:找不到模块'D:/ test / *'

[英]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. 我正在本地网站上使用node.js,我想安装一个模块。 The problem is npm doesn't seem to be working. 问题是npm似乎不起作用。 For example, if I execute the following command npm -v , I have this : 例如,如果我执行以下命令npm -v ,则具有以下命令:

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. 我在Windows上,并且遵循node.js的默认安装。

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/*) . 对我来说,这是因为您在require(D:\\ test *)中给定的绝对路径将require的所有路径更改为require(D:/ test / *)。 if this is not case u need to reinstall ur npm 如果不是这种情况,则需要重新安装ur npm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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