首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >npm命令使用不相关的包和包版本操纵Packy-lock.json

npm命令使用不相关的包和包版本操纵Packy-lock.json
EN

Stack Overflow用户
提问于 2022-05-01 12:44:51
回答 1查看 731关注 0票数 -2

我正在使用OpenAI API进行一个项目,虽然它在笔记本电脑上工作得很好,但在我的桌面上却不起作用。

我从git中克隆了我的项目,然后在npm命令之后使用了命令。当我使用npm时,安装npm时,npm不会抛出任何错误或警告,并操作我的包-lock.json,如下所示

代码语言:javascript
复制
{
  "name": "open-api",
  "version": "2.0.0",
  "lockfileVersion": 2,
  "requires": true,
  "packages": {
    "": {
      "name": "open-api",
      "version": "2.0.0",
      "license": "ISC",
      "dependencies": {
        "cors": "^2.8.5",
        "dotenv": "^16.0.0",
        "express": "^4.18.0",
        "openai": "^2.0.5"
      },
      "devDependencies": {}
    },
    "ode_modules/accepts": {
      "version": "1.3.8",
      "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
      "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
      "extraneous": true,
      "dependencies": {
        "mime-types": "~2.1.34",
        "negotiator": "0.6.3"
      },
      "devDependencies": {
        "deep-equal": "1.0.1",
        "eslint": "7.32.0",
        "eslint-config-standard": "14.1.1",
        "eslint-plugin-import": "2.25.4",
        "eslint-plugin-markdown": "2.2.1",
        "eslint-plugin-node": "11.1.0",
        "eslint-plugin-promise": "4.3.1",
        "eslint-plugin-standard": "4.1.0",
        "mocha": "9.2.0",
        "nyc": "15.1.0"
      },
      "engines": {
        "node": ">= 0.6"
      }
    },

虽然我原来在Packy-lock.json中的代码完全是这样的

代码语言:javascript
复制
{
  "name": "open-api",
  "version": "2.0.0",
  "lockfileVersion": 2,
  "requires": true,
  "packages": {
    "": {
      "name": "open-api",
      "version": "2.0.0",
      "license": "ISC",
      "dependencies": {
        "cors": "^2.8.5",
        "dotenv": "^16.0.0",
        "express": "^4.18.0",
        "openai": "^2.0.5"
      },
      "devDependencies": {}
    },
    "node_modules/accepts": {
      "version": "1.3.8",
      "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
      "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
      "dependencies": {
        "mime-types": "~2.1.34",
        "negotiator": "0.6.3"
      },
      "engines": {
        "node": ">= 0.6"
      }

如果你需要小心的话,package.json;

代码语言:javascript
复制
{
  "name": "open-api",
  "version": "2.0.0",
  "main": "index.js",
  "dependencies": {
    "cors": "^2.8.5",
    "dotenv": "^16.0.0",
    "express": "^4.18.0",
    "openai": "^2.0.5"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "description": ""
}

由于这种操作,npm没有安装任何node_modules,总是使用"ode_modules“、"de_modules”或"_modules“命名的依赖项操作package-lock.json,我不明白为什么没有任何错误消息来解决这个问题。

我试过;

  • 删除包-锁.again和npm重新安装
  • 为每个手动安装npm安装“包名”的所有软件包,但版本以"*"

的形式返回依赖项

代码语言:javascript
复制
  "name": "open-api",
  "version": "2.0.0",
  "main": "index.js",
  "dependencies": {
    "express": "*"
  },

  • npm安装-详细没有在日志

中发现任何错误

代码语言:javascript
复制
npm verb cli [
npm verb cli   'C:\\Program Files\\nodejs\\node.exe',
npm verb cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli   'install',
npm verb cli   '--verbose'
npm verb cli ]
npm info using npm@8.5.5
npm info using node@v16.15.0
npm timing npm:load:whichnode Completed in 1ms
npm timing config:load:defaults Completed in 1ms
npm timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc Completed in 3ms
npm timing config:load:builtin Completed in 3ms
npm timing config:load:cli Completed in 2ms
npm timing config:load:env Completed in 0ms
npm timing config:load:file:F:\Programlar\İş\Denemeler\OpenAI\server\.npmrc Completed in 0ms
npm timing config:load:project Completed in 4ms
npm timing config:load:file:C:\Users\Murat\.npmrc Completed in 0ms
npm timing config:load:user Completed in 0ms
npm timing config:load:file:C:\Users\Murat\AppData\Roaming\npm\etc\npmrc Completed in 0ms
npm timing config:load:global Completed in 0ms
npm timing config:load:validate Completed in 0ms
npm timing config:load:credentials Completed in 1ms
npm timing config:load:setEnvs Completed in 0ms
npm timing config:load Completed in 12ms
npm timing npm:load:configload Completed in 12ms
npm timing npm:load:setTitle Completed in 1ms
npm timing config:load:flatten Completed in 3ms
npm timing npm:load:display Completed in 14ms
npm verb logfile C:\Users\Murat\AppData\Local\npm-cache\_logs\2022-05-01T13_46_15_241Z-debug-0.log
npm timing npm:load:logFile Completed in 6ms
npm timing npm:load:timers Completed in 0ms
npm timing npm:load:configScope Completed in 0ms
npm timing npm:load Completed in 35ms
npm timing arborist:ctor Completed in 0ms
npm timing idealTree:init Completed in 31ms
npm timing idealTree:userRequests Completed in 1ms
npm verb shrinkwrap failed to load ode_modules/.package-lock.json missing from lockfile: ode_modules/accepts
npm http fetch GET 200 https://registry.npmjs.org/cors 522ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/dotenv 133ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/express 6ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/openai 938ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/content-disposition 75ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/body-parser 78ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/accepts 79ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/vary 81ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/cookie 82ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/cookie-signature 83ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/content-type 86ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/encodeurl 85ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/array-flatten 90ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/escape-html 89ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/depd 91ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/finalhandler 91ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/merge-descriptors 91ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/http-errors 94ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/fresh 95ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/etag 97ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/on-finished 98ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/parseurl 97ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/methods 100ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/path-to-regexp 99ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/debug 107ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/proxy-addr 101ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/safe-buffer 100ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/qs 101ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/send 101ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/statuses 100ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/range-parser 104ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/serve-static 103ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/type-is 103ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/utils-merge 104ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/setprototypeof 109ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/object-assign 183ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/form-data 418ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/axios 439ms (cache revalidated)
npm timing idealTree:#root Completed in 2078ms
npm timing idealTree:ode_modules/cors Completed in 2ms
npm timing idealTree:ode_modules/dotenv Completed in 0ms
npm http fetch GET 200 https://registry.npmjs.org/toidentifier 34ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/bytes 40ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/mime-types 42ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/unpipe 41ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/iconv-lite 46ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/destroy 47ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/negotiator 49ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/ee-first 44ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/raw-body 49ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/ipaddr.js 46ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/inherits 49ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/ms 50ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/side-channel 49ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/forwarded 55ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/media-typer 54ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/mime 57ms (cache hit)
npm timing idealTree:ode_modules/express Completed in 101ms
npm http fetch GET 200 https://registry.npmjs.org/mime-db 4ms (cache hit)
npm timing idealTree:ode_modules/accepts Completed in 8ms
npm timing idealTree:ode_modules/array-flatten Completed in 0ms
npm http fetch GET 200 https://registry.npmjs.org/safer-buffer 4ms (cache hit)
npm timing idealTree:ode_modules/body-parser Completed in 16ms
npm timing idealTree:ode_modules/bytes Completed in 0ms
npm timing idealTree:ode_modules/content-disposition Completed in 1ms
npm timing idealTree:ode_modules/content-type Completed in 0ms
npm timing idealTree:ode_modules/cookie Completed in 0ms
npm timing idealTree:ode_modules/cookie-signature Completed in 0ms
npm timing idealTree:ode_modules/debug Completed in 1ms
npm timing idealTree:ode_modules/depd Completed in 0ms
npm timing idealTree:ode_modules/destroy Completed in 0ms
npm timing idealTree:ode_modules/encodeurl Completed in 0ms
npm timing idealTree:ode_modules/escape-html Completed in 0ms
npm timing idealTree:ode_modules/etag Completed in 0ms
npm timing idealTree:ode_modules/finalhandler Completed in 5ms
npm timing idealTree:ode_modules/debug Completed in 0ms
npm timing idealTree:ode_modules/encodeurl Completed in 0ms
npm timing idealTree:ode_modules/escape-html Completed in 0ms
npm timing idealTree:ode_modules/fresh Completed in 0ms
npm timing idealTree:ode_modules/http-errors Completed in 3ms
npm timing idealTree:ode_modules/depd Completed in 0ms
npm timing idealTree:ode_modules/iconv-lite Completed in 1ms
npm timing idealTree:ode_modules/inherits Completed in 0ms
npm timing idealTree:ode_modules/merge-descriptors Completed in 0ms
npm timing idealTree:ode_modules/methods Completed in 0ms
npm timing idealTree:ode_modules/mime-types Completed in 1ms
npm timing idealTree:ode_modules/mime-db Completed in 0ms
npm timing idealTree:ode_modules/ms Completed in 0ms
npm timing idealTree:ode_modules/negotiator Completed in 0ms
npm timing idealTree:ode_modules/object-assign Completed in 0ms
npm timing idealTree:ode_modules/on-finished Completed in 0ms
npm timing idealTree:ode_modules/ee-first Completed in 0ms
npm http fetch GET 200 https://registry.npmjs.org/combined-stream 138ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/asynckit 140ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/follow-redirects 935ms (cache revalidated)
npm timing idealTree:ode_modules/openai Completed in 937ms
npm timing idealTree:ode_modules/axios Completed in 2ms
npm timing idealTree:ode_modules/follow-redirects Completed in 0ms
npm http fetch GET 200 https://registry.npmjs.org/delayed-stream 149ms (cache revalidated)
npm timing idealTree:ode_modules/form-data Completed in 153ms
npm timing idealTree:ode_modules/asynckit Completed in 0ms
npm timing idealTree:ode_modules/combined-stream Completed in 1ms
npm timing idealTree:ode_modules/delayed-stream Completed in 0ms
npm timing idealTree:ode_modules/mime-types Completed in 0ms
npm timing idealTree:ode_modules/mime-db Completed in 0ms
npm timing idealTree:ode_modules/parseurl Completed in 0ms
npm timing idealTree:ode_modules/path-to-regexp Completed in 0ms
npm timing idealTree:ode_modules/proxy-addr Completed in 1ms
npm timing idealTree:ode_modules/forwarded Completed in 0ms
npm timing idealTree:ode_modules/ipaddr.js Completed in 0ms
npm http fetch GET 200 https://registry.npmjs.org/get-intrinsic 9ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/call-bind 11ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/object-inspect 11ms (cache hit)
npm timing idealTree:ode_modules/qs Completed in 15ms
npm timing idealTree:ode_modules/range-parser Completed in 0ms
npm timing idealTree:ode_modules/raw-body Completed in 4ms
npm timing idealTree:ode_modules/bytes Completed in 0ms
npm timing idealTree:ode_modules/http-errors Completed in 3ms
npm timing idealTree:ode_modules/depd Completed in 0ms
npm timing idealTree:ode_modules/iconv-lite Completed in 1ms
npm timing idealTree:ode_modules/inherits Completed in 0ms
npm timing idealTree:ode_modules/safe-buffer Completed in 0ms
npm timing idealTree:ode_modules/safer-buffer Completed in 0ms
npm timing idealTree:ode_modules/send Completed in 12ms
npm timing idealTree:ode_modules/debug Completed in 2ms
npm timing idealTree:ode_modules/depd Completed in 0ms
npm timing idealTree:ode_modules/destroy Completed in 0ms
npm timing idealTree:ode_modules/encodeurl Completed in 0ms
npm timing idealTree:ode_modules/escape-html Completed in 0ms
npm timing idealTree:ode_modules/etag Completed in 0ms
npm timing idealTree:ode_modules/fresh Completed in 0ms
npm timing idealTree:ode_modules/http-errors Completed in 5ms
npm timing idealTree:ode_modules/depd Completed in 0ms
npm timing idealTree:ode_modules/inherits Completed in 1ms
npm timing idealTree:ode_modules/mime Completed in 0ms
npm timing idealTree:ode_modules/ms Completed in 0ms
npm timing idealTree:ode_modules/on-finished Completed in 1ms
npm timing idealTree:ode_modules/ee-first Completed in 0ms
npm timing idealTree:ode_modules/range-parser Completed in 0ms
npm timing idealTree:ode_modules/serve-static Completed in 3ms
npm timing idealTree:ode_modules/encodeurl Completed in 0ms
npm timing idealTree:ode_modules/escape-html Completed in 0ms
npm timing idealTree:ode_modules/parseurl Completed in 0ms
npm timing idealTree:ode_modules/send Completed in 7ms
npm timing idealTree:ode_modules/debug Completed in 1ms
npm timing idealTree:ode_modules/depd Completed in 0ms
npm timing idealTree:ode_modules/destroy Completed in 0ms
npm timing idealTree:ode_modules/encodeurl Completed in 0ms
npm timing idealTree:ode_modules/escape-html Completed in 0ms
npm timing idealTree:ode_modules/etag Completed in 0ms
npm timing idealTree:ode_modules/fresh Completed in 0ms
npm timing idealTree:ode_modules/http-errors Completed in 5ms
npm timing idealTree:ode_modules/depd Completed in 0ms
npm timing idealTree:ode_modules/inherits Completed in 0ms
npm timing idealTree:ode_modules/mime Completed in 0ms
npm timing idealTree:ode_modules/ms Completed in 0ms
npm timing idealTree:ode_modules/on-finished Completed in 1ms
npm timing idealTree:ode_modules/ee-first Completed in 0ms
npm timing idealTree:ode_modules/range-parser Completed in 0ms
npm timing idealTree:ode_modules/setprototypeof Completed in 0ms
npm http fetch GET 200 https://registry.npmjs.org/has 7ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/has-symbols 7ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/function-bind 9ms (cache hit)
npm timing idealTree:ode_modules/side-channel Completed in 13ms
npm timing idealTree:ode_modules/call-bind Completed in 3ms
npm timing idealTree:ode_modules/function-bind Completed in 0ms
npm timing idealTree:ode_modules/get-intrinsic Completed in 1ms
npm timing idealTree:ode_modules/function-bind Completed in 1ms
npm timing idealTree:ode_modules/has Completed in 1ms
npm timing idealTree:ode_modules/function-bind Completed in 0ms
npm timing idealTree:ode_modules/has-symbols Completed in 0ms
npm timing idealTree:ode_modules/object-inspect Completed in 0ms
npm timing idealTree:ode_modules/statuses Completed in 0ms
npm timing idealTree:ode_modules/toidentifier Completed in 0ms
npm timing idealTree:ode_modules/type-is Completed in 2ms
npm timing idealTree:ode_modules/media-typer Completed in 0ms
npm timing idealTree:ode_modules/mime-types Completed in 1ms
npm timing idealTree:ode_modules/mime-db Completed in 0ms
npm timing idealTree:ode_modules/unpipe Completed in 0ms
npm timing idealTree:ode_modules/utils-merge Completed in 0ms
npm timing idealTree:ode_modules/vary Completed in 0ms
npm timing idealTree:buildDeps Completed in 3438ms
npm timing idealTree:fixDepFlags Completed in 0ms
npm timing idealTree Completed in 3472ms
npm timing reify:loadTrees Completed in 3473ms
npm timing reify:diffTrees Completed in 0ms
npm timing reify:retireShallow Completed in 0ms
npm timing reify:createSparse Completed in 0ms
npm timing reify:loadBundles Completed in 0ms
npm timing reify:unpack Completed in 1ms
npm timing reify:unretire Completed in 0ms
npm timing build:queue Completed in 0ms
npm timing build:deps Completed in 0ms
npm timing build Completed in 1ms
npm timing reify:build Completed in 2ms
npm timing reify:trash Completed in 0ms
npm timing reify:save Completed in 11ms
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 354ms
npm timing auditReport:getReport Completed in 357ms
npm timing auditReport:init Completed in 0ms
npm timing reify:audit Completed in 358ms
npm timing reify Completed in 3844ms

up to date, audited 67 packages in 4s

found 0 vulnerabilities
npm timing command:install Completed in 3851ms
npm verb exit 0
npm timing npm Completed in 4132ms
npm info ok

How to completely remove node.js from Windows描述的

  • 删除节点和npm

这些都不适合我,对此有什么解决办法吗?

纱线安装工作正常,但这不是我的解决方案,我需要与npm合作

EN

回答 1

Stack Overflow用户

发布于 2022-05-03 14:27:53

我已经找到了一个解决方案,通过更改父文件夹的名称,它开始正常工作,IDK到底发生了什么,但如果有人面临类似的问题,这对我是有效的!

请让我知道您对可能发生的事情的想法,谢谢您的提前!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72076826

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档