Can't resolve node package when i use npm convex dev
X [ERROR] Could not resolve "path"
node_modules/rimraf/node_modules/glob/common.js:14:19:
14 │ var path = require("path")
╵ ~~
The package "path" wasn't found on the file system but is built into node. Are you trying to
bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
X [ERROR] Could not resolve "path"
node_modules/rimraf/node_modules/glob/sync.js:9:19:
9 │ var path = require('path')
╵ ~~
The package "path" wasn't found on the file system but is built into node. Are you trying to
bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
X [ERROR] Could not resolve "fs"
node_modules/fs.realpath/old.js:24:17:
24 │ var fs = require('fs');
╵ ~~
The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle
for node? You can use "platform: 'node'" to do that, which will remove this error.
X [ERROR] Could not resolve "assert"
node_modules/rimraf/node_modules/glob/sync.js:10:21:
10 │ var assert = require('assert')
╵ ~~
The package "assert" wasn't found on the file system but is built into node. Are you trying to
bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
I have those errors when i want to update my convex functions with npx convex dev and impossible to resolve in order to get my changes.
I tried to update all my packages, update convex
I actually use only an httpAction in my project
3 Replies
You need to add 'use node' to the top of the file to get the node runtime. But note that Convex functions are serverless and don't have file system access (in case you're trying to use rimraf directly).
Runtimes | Convex Developer Hub
Convex functions can run in two runtimes:
Thank you so much. I finally found the problem came from bcrypt dependancies. I changed with bcryptjs and its all good now