2 years ago
I added an npm package to my code @nestjs/schedule which has a function using crypto.randomUUID which probably isnt supported in the current node version my railway instance is using? How can i change it?
ⓘ Deployment information is only viewable by project members and Railway employees.
6 Replies
2 years ago
Error stack:
```
/app/node_modules/@nestjs/schedule/dist/scheduler.orchestrator.js:90
const name = options.name || crypto.randomUUID();
^
ReferenceError: crypto is not defined
at SchedulerOrchestrator.addCron (/app/node_modules/@nestjs/schedule/dist/scheduler.orchestrator.js:90:38)
at ScheduleExplorer.lookupSchedulers (/app/node_modules/@nestjs/schedule/dist/schedule.explorer.js:67:51)
at processMethod (/app/node_modules/@nestjs/schedule/dist/schedule.explorer.js:45:24)
at Array.forEach ()
at /app/node_modules/@nestjs/schedule/dist/schedule.explorer.js:54:18
at Array.forEach ()
at ScheduleExplorer.explore (/app/node_modules/@nestjs/schedule/dist/schedule.explorer.js:39:26)
at ScheduleExplorer.onModuleInit (/app/node_modules/@nestjs/schedule/dist/schedule.explorer.js:32:14)
at MapIterator.iteratee (/app/node_modules/@nestjs/core/hooks/on-module-init.hook.js:22:43)
at MapIterator.next (/app/node_modules/iterare/src/map.ts:9:39)
Node.js v18.20.5
```
2 years ago
the exact same code works on my environment which is using v20.18.1
2 years ago
You can change the Node version by specifying your desired version in the engines.node field in your package.json
brody
You can change the Node version by specifying your desired version in the `engines.node` field in your `package.json`
2 years ago
Thanks!
2 years ago
dhkim
I tried versioning engines.node on the same issue and got the following error  ``` { ... "version": "0.0.1", "engines": { "node": "20.11.0" }, "scripts": { ... ``` how can I fix it?
a year ago
version 22.11.0 helped me
