NodeJS npm i错误“错误:找不到模块'nopt'“

pbwdgjma  于 2023-03-01  发布在  Node.js
关注(0)|答案(3)|浏览(580)

当我尝试安装节点模块时,它抛出“错误:找不到模块'nopt”我尝试了不同的方法,但没有一个工作。我在下面的图像中附加了错误消息

{
  "name": "server",
  "version": "1.0.0",
  "main": "index.js",
  "private": true,
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "run": "nodemon server.js",
    "start": "node server.js"
  },
  "license": "UNLICENSED",
  "dependencies": {
    "@aws-sdk/client-sagemaker-runtime": "^3.56.0",
    "async": "^3.2.0",
    "aws-sdk": "^2.1019.0",
    "connect-mongo": "^3.2.0",
    "cookie-parser": "^1.4.5",
    "dotenv": "^8.2.0",
    "express": "^4.17.1",
    "express-session": "^1.17.1",
    "jsonwebtoken": "^8.5.1",
    "mongodb": "^4.8.1",
    "mongoose": "^6.5.2",
    "morgan": "^1.10.0",
    "node-fetch": "^3.1.1",
    "node-schedule": "^2.0.0",
    "passport": "^0.6.0",
    "passport-jwt": "^4.0.0",
    "passport-local": "^1.0.0",
    "serverless-http": "^2.7.0",
    "xmlhttprequest": "^1.8.0"
  },
  "devDependencies": {
    "nodemon": "^2.0.15",
    "serverless-offline": "^6.8.0"
  }

yeotifhr

yeotifhr1#

把“devDependencies”中的所有值都移到“dependencies”中。然后尝试删除其他提问者提到的“node_modules”。我用她的方法解决了这个问题。
我是日本人,所以我用谷歌翻译来创建文档。句子可能很奇怪。

{
  "name": "server",
  "version": "1.0.0",
  "main": "index.js",
  "private": true,
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "run": "nodemon server.js",
    "start": "node server.js"
  },
  "license": "UNLICENSED",
  "dependencies": {
    "@aws-sdk/client-sagemaker-runtime": "^3.56.0",
    "async": "^3.2.0",
    "aws-sdk": "^2.1019.0",
    "connect-mongo": "^3.2.0",
    "cookie-parser": "^1.4.5",
    "dotenv": "^8.2.0",
    "express": "^4.17.1",
    "express-session": "^1.17.1",
    "jsonwebtoken": "^8.5.1",
    "mongodb": "^4.8.1",
    "mongoose": "^6.5.2",
    "morgan": "^1.10.0",
    "node-fetch": "^3.1.1",
    "node-schedule": "^2.0.0",
    "passport": "^0.6.0",
    "passport-jwt": "^4.0.0",
    "passport-local": "^1.0.0",
    "serverless-http": "^2.7.0",
    "xmlhttprequest": "^1.8.0",
    "nodemon": "^2.0.15",
    "serverless-offline": "^6.8.0"
  }
cnjp1d6j

cnjp1d6j2#

请尝试删除该软件包,重新安装,然后重新安装npm

xurqigkl

xurqigkl3#

您的package.json没有nopt软件包的记录,因此您必须在终端中运行以下命令来安装它:npm i nopt

相关问题