NangoHQ / nango

A single API for all your integrations.
https://www.nango.dev
Other
4.33k stars 382 forks source link

'npm run ts-build' fails on Windows in git-bash and command prompt #2342

Open bburns opened 2 weeks ago

bburns commented 2 weeks ago

I cloned nango recently and ran ts-build - it fails at the cli's copy:types script -

in git-bash -

[/c/Users/bburns/Workspace/forks/nango]
$ npm run ts-build
> @nangohq/nango@0.39.32 ts-build
> tsc -b tsconfig.build.json && npm run -w nango postbuild
> nango@0.40.0 postbuild
> npm run copy:types
> nango@0.40.0 copy:types
> cp `node -p "require.resolve('@nangohq/shared/dist/sdk/sync.d.ts')"` './dist/nango-sync.d.ts'
cp: target './dist/nango-sync.d.ts' is not a directory
npm error Lifecycle script `copy:types` failed with error:
npm error code 1
npm error path C:\Users\bburns\Workspace\forks\nango\packages\cli
npm error workspace nango@0.40.0
npm error location C:\Users\bburns\Workspace\forks\nango\packages\cli
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c cp `node -p "require.resolve('@nangohq/shared/dist/sdk/sync.d.ts')"` './dist/nango-sync.d.ts'
npm error Lifecycle script `postbuild` failed with error:
npm error code 1
npm error path C:\Users\bburns\Workspace\forks\nango\packages\cli
npm error workspace nango@0.40.0
npm error location C:\Users\bburns\Workspace\forks\nango\packages\cli
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c npm run copy:types

in command prompt -

C:\Users\bburns\Workspace\forks\nango
> npm run ts-build
> @nangohq/nango@0.39.32 ts-build
> tsc -b tsconfig.build.json && npm run -w nango postbuild
> nango@0.40.0 postbuild
> npm run copy:types
> nango@0.40.0 copy:types
> cp `node -p "require.resolve('@nangohq/shared/dist/sdk/sync.d.ts')"` './dist/nango-sync.d.ts'
'cp' is not recognized as an internal or external command,
operable program or batch file.
npm error Lifecycle script `copy:types` failed with error:
npm error code 1
npm error path C:\Users\bburns\Workspace\forks\nango\packages\cli
npm error workspace nango@0.40.0
npm error location C:\Users\bburns\Workspace\forks\nango\packages\cli
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c cp `node -p "require.resolve('@nangohq/shared/dist/sdk/sync.d.ts')"` './dist/nango-sync.d.ts'
npm error Lifecycle script `postbuild` failed with error:
npm error code 1
npm error path C:\Users\bburns\Workspace\forks\nango\packages\cli
npm error workspace nango@0.40.0
npm error location C:\Users\bburns\Workspace\forks\nango\packages\cli
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c npm run copy:types

A fix - in packages/cli/package.json change

"copy:types": "cp `node -p 
  \"require.resolve('@nangohq/shared/dist/sdk/sync.d.ts')\"`
   './dist/nango-sync.d.ts'",

to

"copy:types": "node -r fs -e 
  \"fs.cpSync(require.resolve('@nangohq/shared/dist/sdk/sync.d.ts'), 
  './dist/nango-sync.d.ts')\"",
linear[bot] commented 2 weeks ago

NAN-1215 'npm run ts-build' fails on Windows in git-bash and command prompt