Cannot find module '@ioc:Adonis/Core/Auth'
eldiyar312 opened this issue · 3 comments
Package version
"devDependencies": {
"@adonisjs/assembler": "^5.3.8",
"adonis-preset-ts": "^2.1.0",
"eslint": "^8.2.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-adonis": "^2.0.0",
"eslint-plugin-prettier": "^4.0.0",
"pino-pretty": "^7.1.0",
"prettier": "^2.4.1",
"typescript": "^4.4.4",
"youch": "^2.2.2",
"youch-terminal": "^1.1.1"
},
"dependencies": {
"@adonisjs/auth": "^8.0.10",
"@adonisjs/core": "^5.4.0",
"@adonisjs/lucid": "^16.3.2",
"@adonisjs/redis": "^7.0.9",
"@adonisjs/repl": "^3.1.7",
"jsonwebtoken": "^8.5.1",
"luxon": "^2.1.1",
"pg": "^8.7.1",
"phc-bcrypt": "^1.0.7",
"proxy-addr": "^2.0.7",
"reflect-metadata": "^0.1.13",
"source-map-support": "^0.5.20"
}
Node.js and npm version
node - v16.13.0
npm - v8.1.3
Sample Code (to reproduce the issue)
import Route from '@ioc:Adonis/Core/Auth'
import { signin, signup, forgotPassword } from './routes/auth'
Route.post('/api/signin', signin)
Route.post('/api/signup', signup)
Route.post('/api/forgot/password', forgotPassword)
BONUS (a sample repo to reproduce the issue)
all configs (auth, lucid) configurated.
I've tried: reinstall all dependencies and restart the entire working environment. Created a new adonis project with all dependencies - but the same problem (Cannot find module '@IOC: Adonis / Core / Auth').
I was looking at an example from https://docs.adonisjs.com/guides/auth/api-tokens-guard
Sample Repository
Hey! 👋🏻
Could you please share a repository with the minimum amount of code to reproduce your issue?
The issue was with docs. It has been fixed. Update your routes file to use the following import.
import Route from '@ioc:Adonis/Core/Route'