Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings
adonisjs

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

import error with ts-node-maintained#4826

AnsweredbyRomainLanz
klever34 asked this question inHelp
Discussion options

Does anyone know why runningnode ace migration:run --force returns this error?

node:internal/modules/esm/resolve:857  throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);        ^Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'ts-node-maintained' imported from /app/ace.js    at packageResolve (node:internal/modules/esm/resolve:857:9)    at moduleResolve (node:internal/modules/esm/resolve:926:18)    at defaultResolve (node:internal/modules/esm/resolve:1056:11)    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:654:12)    at #cachedDefaultResolve (node:internal/modules/esm/loader:603:25)    at ModuleLoader.resolve (node:internal/modules/esm/loader:586:38)    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:242:38)    at ModuleJob._link (node:internal/modules/esm/module_job:135:49) {  code: 'ERR_MODULE_NOT_FOUND'}Node.js v22.12.0

I'm working with the latest version of AdonisJS.

You must be logged in to vote

You're missing a few steps. In your case, it looks like you’re running the command from the project's root directory, which still contains the unbuilt application.

I’m not sure how Heroku works, but you need to build the application and deploy only the build folder. After that, re-install the production dependencies from within that folder to keep your deployment as minimal as possible.

Replies: 2 comments 8 replies

Comment options

Hey@klever34! 👋🏻

Do you havets-node-maintained installed?

You must be logged in to vote
6 replies
@klever34
Comment options

@RomainLanz
Yes, I do.

  "devDependencies": {    "@adonisjs/assembler": "^7.8.2",    "@adonisjs/eslint-config": "^2.0.0-beta.6",    "@adonisjs/prettier-config": "^1.4.0",    "@adonisjs/tsconfig": "^1.4.0",    "@japa/api-client": "^2.0.3",    "@japa/assert": "^3.0.0",    "@japa/plugin-adonisjs": "^3.0.1",    "@japa/runner": "^3.1.4",    "@swc/core": "1.7.26",    "@types/luxon": "^3.4.2",    "@types/node": "^22.7.5",    "eslint": "^9.12.0",    "hot-hook": "^0.3.1",    "pino-pretty": "^11.2.2",    "prettier": "^3.3.3",    "ts-node-maintained": "^10.9.4",    "typescript": "~5.6"  },
@RomainLanz
Comment options

Are you trying to runnode ace in production without having built the application?

@klever34
Comment options

@RomainLanz I am trying to deploy to Heroku. The build gets done completely. The funny thing is it either returns the ts-node-maintained error or the one below in the logs

remote: Building source:remote: remote: -----> Building on the Heroku-24 stackremote: -----> Using buildpack: heroku/nodejsremote: -----> Node.js app detectedremote:        remote: -----> Creating runtime environmentremote:        remote:        NPM_CONFIG_LOGLEVEL=errorremote:        USE_YARN_CACHE=trueremote:        NODE_VERBOSE=falseremote:        NODE_ENV=productionremote:        NODE_MODULES_CACHE=trueremote:        remote: -----> Installing binariesremote:        engines.node (package.json):   unspecifiedremote:        engines.npm (package.json):    unspecified (use default)remote:        engines.yarn (package.json):   unspecified (use default)remote:        remote:        Resolving node version 22.x...remote:        Downloading and installing node 22.12.0...remote:        Using default npm version: 10.9.0remote:        Resolving yarn version 1.22.x...remote:        Downloading and installing yarn (1.22.22)remote:        Installed yarn 1.22.22remote:        remote: -----> Restoring cacheremote:        - yarn cacheremote:        remote: -----> Installing dependenciesremote:        Installing node modules (yarn.lock)remote:        yarn install v1.22.22remote:        [1/4] Resolving packages...remote:        warning Resolution field "strtok3@8.0.1" is incompatible with requested version "strtok3@^9.0.1"remote:        [2/4] Fetching packages...remote:        [3/4] Linking dependencies...remote:        warning "@japa/assert > api-contract-validator > api-schema-builder > swagger-parser > @apidevtools/swagger-parser@10.0.3" has unmet peer dependency "openapi-types@>=7".remote:        [4/4] Building fresh packages...remote:        Done in 3.29s.remote:        remote: -----> Buildremote:        Running build (yarn)remote:        yarn run v1.22.22remote:        $ node ace buildremote:        [ info ] cleaning up output directory (build)remote:        [ info ] compiling typescript source (tsc)remote:        [ info ] rewrited ace file (build/ace.js)remote:        [ info ] copying meta files to the output directoryremote:        [ success ] build completedremote:        remote:        ╭────────────────────────────────────────────────────────────────────────╮remote:        │    Run the following commands to start the server in production        │remote:        │────────────────────────────────────────────────────────────────────────│remote:        │                                                                        │remote:        │    ❯ cd build                                                          │remote:        │    ❯ yarn install --production                                         │remote:        │    ❯ node bin/server.js                                                │remote:        │                                                                        │remote:        ╰────────────────────────────────────────────────────────────────────────╯remote:        Done in 3.69s.remote:        remote: -----> Pruning devDependenciesremote:        yarn install v1.22.22remote:        [1/4] Resolving packages...remote:        warning Resolution field "strtok3@8.0.1" is incompatible with requested version "strtok3@^9.0.1"remote:        [2/4] Fetching packages...remote:        [3/4] Linking dependencies...remote:        warning "@japa/assert > api-contract-validator > api-schema-builder > swagger-parser > @apidevtools/swagger-parser@10.0.3" has unmet peer dependency "openapi-types@>=7".remote:        [4/4] Building fresh packages...remote:        warning Ignored scripts due to flag.remote:        Done in 1.22s.remote:        remote: -----> Caching buildremote:        - yarn cacheremote:        remote: -----> Build succeeded!remote:  !     Unmet dependencies don't fail yarn install but may cause runtime issuesremote:        https://github.com/npm/npm/issues/7494remote: remote: -----> Discovering process typesremote:        Procfile declares types -> release, webremote: remote: -----> Compressing...remote:        Done: 107.4Mremote: -----> Launching...remote:  !     Release command declared: this new release will not be available until the command succeeds.remote:        Released v31remote:        https://api-ae6.herokuapp.com/ deployed to Herokuremote: remote: Verifying deploy.... done.remote: Running release command...remote: remote: remote: node:internal/modules/run_main:122 remote:     triggerUncaughtException(remote:     ^remote: [Object: null prototype] {remote:   [Symbol(nodejs.util.inspect.custom)]: [Function: [nodejs.util.inspect.custom]]remote: }remote: remote: Node.js v22.12.0remote: Waiting for release... failed.
@RomainLanz
Comment options

You're missing a few steps. In your case, it looks like you’re running the command from the project's root directory, which still contains the unbuilt application.

I’m not sure how Heroku works, but you need to build the application and deploy only the build folder. After that, re-install the production dependencies from within that folder to keep your deployment as minimal as possible.

Answer selected byklever34
@klever34
Comment options

Let me look into your suggestion@RomainLanz
Thanks

@klever34
Comment options

@RomainLanz You're right about me not running the command in the correct folder. I only needed toCD into the build folder.
For anyone working with the current Adonis, here's theProcfile that worked for me:

web: node build/bin/server.jsrelease: cd build && node ace migration:run --force
Comment options

Facing this exact same issue while deploying on coolify using Dockerfile

You must be logged in to vote
2 replies
@hackerrahul
Comment options

2025-Sep-20 08:06:18.256762#14 [build 5/5] RUN node ace build --ignore-ts-errors2025-Sep-20 08:06:18.256762#14 0.123 node:internal/modules/package_json_reader:2562025-Sep-20 08:06:18.256762#14 0.123   throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);2025-Sep-20 08:06:18.256762#14 0.123         ^2025-Sep-20 08:06:18.256762#14 0.1232025-Sep-20 08:06:18.256762#14 0.123 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'ts-node-maintained' imported from /app/ace.js2025-Sep-20 08:06:18.256762#14 0.123     at Object.getPackageJSONURL (node:internal/modules/package_json_reader:256:9)2025-Sep-20 08:06:18.256762#14 0.123     at packageResolve (node:internal/modules/esm/resolve:768:81)2025-Sep-20 08:06:18.256762#14 0.123     at moduleResolve (node:internal/modules/esm/resolve:854:18)2025-Sep-20 08:06:18.256762#14 0.123     at defaultResolve (node:internal/modules/esm/resolve:984:11)2025-Sep-20 08:06:18.256762#14 0.123     at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:780:12)2025-Sep-20 08:06:18.256762#14 0.123     at #cachedDefaultResolve (node:internal/modules/esm/loader:704:25)2025-Sep-20 08:06:18.256762#14 0.123     at ModuleLoader.resolve (node:internal/modules/esm/loader:687:38)2025-Sep-20 08:06:18.256762#14 0.123     at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:305:38)2025-Sep-20 08:06:18.256762#14 0.123     at ModuleJob._link (node:internal/modules/esm/module_job:137:49) {2025-Sep-20 08:06:18.256762#14 0.123   code: 'ERR_MODULE_NOT_FOUND'2025-Sep-20 08:06:18.256762#14 0.123 }2025-Sep-20 08:06:18.256762#14 0.1232025-Sep-20 08:06:18.256762#14 0.123 Node.js v22.16.02025-Sep-20 08:06:18.256762#14 ERROR: process "/bin/sh -c node ace build --ignore-ts-errors" did not complete successfully: exit code: 12025-Sep-20 08:06:18.256762------2025-Sep-20 08:06:18.256762> [build 5/5] RUN node ace build --ignore-ts-errors:2025-Sep-20 08:06:18.2567620.123     at defaultResolve (node:internal/modules/esm/resolve:984:11)2025-Sep-20 08:06:18.2567620.123     at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:780:12)2025-Sep-20 08:06:18.2567620.123     at #cachedDefaultResolve (node:internal/modules/esm/loader:704:25)2025-Sep-20 08:06:18.2567620.123     at ModuleLoader.resolve (node:internal/modules/esm/loader:687:38)2025-Sep-20 08:06:18.2567620.123     at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:305:38)2025-Sep-20 08:06:18.2567620.123     at ModuleJob._link (node:internal/modules/esm/module_job:137:49) {2025-Sep-20 08:06:18.2567620.123   code: 'ERR_MODULE_NOT_FOUND'2025-Sep-20 08:06:18.2567620.123 }2025-Sep-20 08:06:18.2567620.1232025-Sep-20 08:06:18.2567620.123 Node.js v22.16.02025-Sep-20 08:06:18.256762------
@hackerrahul
Comment options

here is my Dockerfile, which used to work earlier but since 2-3 days this issue started and i am unable to deploy anything. but locally building this dockerfile works

FROM node:22.16.0-alpine3.22 AS base# All deps stageFROM base AS depsWORKDIR /appADD package.json yarn.lock ./RUN yarn install --frozen-lockfile# Production only deps stageFROM base AS production-depsWORKDIR /appADD package.json yarn.lock ./RUN yarn install --frozen-lockfile --production# Build stageFROM base AS buildWORKDIR /appCOPY --from=deps /app/node_modules /app/node_modulesADD . .RUN node ace build --ignore-ts-errors# Production stageFROM baseENV NODE_ENV=productionWORKDIR /appCOPY --from=production-deps /app/node_modules /app/node_modulesCOPY --from=build /app/build /appEXPOSE 3000CMD ["node", "./bin/server.js"]
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Help
Labels
None yet
3 participants
@klever34@RomainLanz@hackerrahul

[8]ページ先頭

©2009-2025 Movatter.jp