简体   繁体   English

安装npm软件包时出现TypeError

[英]TypeError while installing npm package

I'm not very familiar with js-related technologies and now having trouble with package installation. 我对与js相关的技术不是很熟悉,现在在安装软件包时遇到了麻烦。 Log file contains these lines: 日志文件包含以下几行:

1469 verbose stack TypeError: Cannot read property '2.2.2' of undefined
1469 verbose stack     at setData (C:\Program Files\nodejs\node_modules\npm\lib\cache\add-named.js:135:27)
1469 verbose stack     at RES (C:\Program Files\nodejs\node_modules\npm\node_modules\inflight\inflight.js:23:14)
1469 verbose stack     at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:17:25)
1469 verbose stack     at fixName (C:\Program Files\nodejs\node_modules\npm\lib\cache\add-named.js:29:5)
1469 verbose stack     at saved (C:\Program Files\nodejs\node_modules\npm\lib\cache\caching-client.js:173:7)
1469 verbose stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:210:7
1469 verbose stack     at FSReqWrap.oncomplete (fs.js:82:15)

and unfortunately it tells me absolutely nothing. 不幸的是,它完全没有告诉我。 Haven't even a slight idea where to dig in for resolution. 甚至没有一点想法在哪里寻找解决方案。 Maybe someone could guide? 也许有人可以指导?

Check package.json file in the root of your project and mark the dependency with version number 2.2.2 as * 检查project根目录中的package.json文件,并将版本号为2.2.2的依赖项标记为*

 "dependencies": {
    "express": "*",
    "mongodb": "*",
    "underscore": "*",
  }

like this. 像这样。 then run npm install again. 然后再次运行npm install

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

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