Code Monkey home page Code Monkey logo

Comments (9)

syukronarie avatar syukronarie commented on June 5, 2024 9

Looks like there is an issue in alpha version.

I can able to run normally using json-server@^0.17.3

from json-server.

patrickpie83 avatar patrickpie83 commented on June 5, 2024

I have a similar error.
Today I was trying to use json-server-auth, but end up with the error message.

Let me put the error first:

node:internal/modules/cjs/loader:1147
  throw err;
  ^

Error: Cannot find module 'json-server'
Require stack:
- /usr/local/lib/node_modules/json-server-auth/dist/guards.js
- /usr/local/lib/node_modules/json-server-auth/dist/bin.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/json-server-auth/dist/guards.js:6:20)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/local/lib/node_modules/json-server-auth/dist/guards.js',
    '/usr/local/lib/node_modules/json-server-auth/dist/bin.js'
  ]
}

Node.js v20.11.0

In my project, I use npm init to create package.json

then use npm install -D json-server json-server-auth to create node_modules, package-lock.json

and then create db.json file in my project

and use sudo npm install -g json-server-auth ,

then I finally use json-server-auth db.json, but it doesn't start the server,
showed the Error: Cannot find module 'json-server'

package.json code

{
  "name": "vue-hangout-server",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "json-server": "^1.0.0-alpha.22"
  },
  "dependencies": {
    "express": "^4.18.2",
    "json-server-auth": "^2.1.0"
  }
}

I'm sure I install the latest version json-server and json-server-auth,

How can I make sure it finds module 'json-server'?

from json-server.

filipopo avatar filipopo commented on June 5, 2024

Can confirm, it works on 0.17.4 but not on the latest release

from json-server.

ritheesh4 avatar ritheesh4 commented on June 5, 2024

This issue exists for me also.

from json-server.

sjaelselement avatar sjaelselement commented on June 5, 2024

Да, проблема в версии. npm i [email protected] - решение

from json-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.