vercel / vercel/ncc

Im getting strange error on windows server [TS2349: This expression is not callable]

Open
#1,237 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
9.8k
Forks
326
PR merge metrics
No merged PRs in 30d

Description

import path from 'path';
//@ts-ignore
import ncc from '@vercel/ncc';
import fse from 'fs-extra';

const projectRootDir = path.join(__dirname, '..', '..', '..');
const distFolder = path.join(projectRootDir, 'dist', 'sqs-listener_build');

  // Compile the code
  console.log('ncc start');

  const { code, map, assets } = await ncc(path.resolve(__dirname, 'main.ts'));

  console.log('ncc done');

  console.log('write artifact start');

  await fse.writeFile(
    path.join(distFolder, 'index.js'),
    `${code}`,
    'utf-8',
  );

  console.log('write artifact done');

[25.11.2024 23:55.44.059] [LOG] ncc start
[25.11.2024 23:55.44.063] [LOG] ncc: Version 0.38.3
[25.11.2024 23:55.44.063] [LOG] ncc: Compiling file index.js into CJS
[25.11.2024 23:55.45.698] [LOG] ncc: Using typescript@5.5.4 (local user-provided)
[25.11.2024 23:56.41.792] [LOG] Error: [tsl] ERROR in [...]/build.ts(45,39)
TS2349: This expression is not callable.
Type 'typeof import("[...]/node_modules/@vercel/ncc/dist/ncc/index")' has no call signatures.
at [...]/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:23:2001732
at [...]/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:23:389111
at *done (eval at create ([...]/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:21:81694), :9:1)
at eval (eval at create ([...]/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:21:81694), :34:22)

The code works like a charm on my mac.. unfortunately my EC2 is windows server, it fails there, I couldnt figure out how to resolve it.

Please help,
Thank you so much

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with build.ts around line 45 and the @vercel/ncc import shown in the report. Compare the TypeScript and ncc environments on macOS and Windows, then reproduce the TS2349 failure and determine the configuration or package difference responsible. Done means the build completes on Windows without this error, with the relevant behavior verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.