user4569455
user4569455

Reputation: 61

Vercel Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'simple-concat' imported from /var/task/node_modules/mypackage/index.js

I am new to node.js and vercel. My project works in my local computer but when i deploy it to vercel, i get the following error:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'simple-concat' imported from /var/task/node_modules/mypackage/index.js at new NodeError (node:internal/errors:400:5) at packageResolve (node:internal/modules/esm/resolve:894:9) at moduleResolve (node:internal/modules/esm/resolve:987:20) at moduleResolveWithNodePath (node:internal/modules/esm/resolve:938:12) at defaultResolve (node:internal/modules/esm/resolve:1202:79) at nextResolve (node:internal/modules/esm/loader:163:28) at ESMLoader.resolve (node:internal/modules/esm/loader:842:30) at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18) at ModuleWrap. (node:internal/modules/esm/module_job:77:40) at link (node:internal/modules/esm/module_job:76:36) { code: 'ERR_MODULE_NOT_FOUND' } RequestId: 39a6c3ac-c643-4323-83b4-2ed45ad1920e Error: Runtime exited with error: exit status 1 Runtime.ExitError

I tried changing the import there to import concat from 'simple-concat/index.js'

I tried to add environment variables VERCEL_CLI_VERSION with value [email protected]

I tried redeploying

Upvotes: 1

Views: 1997

Answers (1)

Ty Cooper
Ty Cooper

Reputation: 105

Here's a few things to try:

  1. Make sure the package simple-concat is listed in your package.json file as a dependency.
  2. Run npm install or yarn install to install all dependencies locally before you deploy to Vercel. This makes sure that all of your required packages are in the node_modules directory.
  3. If simple-concat is a native node.js module, make sure it's in the engines section of your package.json file. this is important! - it will ensure that the correct version of Node.js is used when the code is being run on Vercel.

Upvotes: 2

Related Questions