SP-CLI install issue- node 18

Hi,

I am using node v 18.9.0. After installing connector, installing dependencies and creating new project ‘sp conn init “my-project”’ and then running ‘npm run dev’. Steps followed from here:

Common CLI Commands | SailPoint Developer Community

I get the following error from ‘npm run dev’ command

[email protected] dev
spcx dist/index.js

‘“-S”’ is not recognized as an internal or external command,
operable program or batch file.

Also when I run ‘sp conn list’, I get the following error

cmdlet Set-ItemProperty at command pipeline position 1
Supply values for the following parameters:
Value:

Hi Samira,

It looks like your first post in the community – welcome!

I’m assuming you are running in PowerShell, and there are a couple of workarounds for the issues you are experiencing –

For the issue when running npm run dev there are a couple of steps you can take to make this work:

  1. Find the file node_modules\.bin\spcx.cmd and edit line 17, removing "%_prog%" text. The resulting file should look like this:
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0

IF EXIST "%dp0%\-S.exe" (
  SET "_prog=%dp0%\-S.exe"
) ELSE (
  SET "_prog=-S"
  SET PATHEXT=%PATHEXT:;.JS;=;%
)

endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & node --enable-source-maps "%dp0%\..\@sailpoint\connector-sdk\dist\bin\spcx.js" %*

Once you do that, the command should work, but you might not be able test – You might need to run tsc to compile the typescript files. You can do the following to give a good experience when debugging:

  1. If you don’t have typescript installed, then run npm install -g typescript
  2. Add the "sourceMap": true option to the tsconfig.json. it should look something like this when complete:
{
  "compilerOptions": {
    "target": "ES2020",
    "module": "commonjs",
    "outDir": "dist",
    "rootDir": "src",
    "strict": true,
    "moduleResolution": "node",
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "sourceMap": true
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "**/*.spec.ts", "**/*.spec.js"]
}
  1. run tsc to compile the typescript and now when you run npm run dev you should be able to set breakpoints on your typescript files within vscode.

for the sp conn list command, if you run sp.exe conn list it should fix the second problem you mentioned

Hopefully that resolves the problem, we are working on improving the experience in PowerShell so that you don’t have to go through these steps in the future.

1 Like

Hi Philip,
Thanks for your help. Now I am able to run npm run dev
when I run sp.exe conn list, it shows the following error:
Error: Missing TokenURL configuration value
I created config.yaml and put in the same folder as sp.exe

Hi Samira,

The config.yaml file should be in your users home directory under the .sp folder. So it would be in a folder like this in windows: C:\Users\{username}\.sp\config.yaml

1 Like

Hi Philip,
many thanks for your help, now I am able to run sp.exe conn list and sp conn create "my-project"
when I try to build and package the connector bundle. it shows the following error:

 > npx ncc build ./src/index.ts -o ./dist -m -C

ncc: Version 0.28.6
ncc: Compiling file index.js
ncc: Using [email protected] (local user-provided)
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at BulkUpdateDecorator.hashFactory (C:\support\saas-connector-project\node_modules\@vercel\ncc\dist\ncc/index.js.cache.js:37:1236202)
    at BulkUpdateDecorator.digest (C:\support\saas-connector-project\node_modules\@vercel\ncc\dist\ncc/index.js.cache.js:37:1235429)
    at NormalModule._initBuildHash (C:\support\saas-connector-project\node_modules\@vercel\ncc\dist\ncc/index.js.cache.js:37:416468)
    at C:\support\saas-connector-project\node_modules\@vercel\ncc\dist\ncc/index.js.cache.js:37:417044
    at processResult (C:\support\saas-connector-project\node_modules\@vercel\ncc\dist\ncc/index.js.cache.js:37:414133)
    at C:\support\saas-connector-project\node_modules\@vercel\ncc\dist\ncc/index.js.cache.js:37:415810
    at C:\support\saas-connector-project\node_modules\@vercel\ncc\dist\ncc/index.js.cache.js:1:883509
    at C:\support\saas-connector-project\node_modules\@vercel\ncc\dist\ncc/index.js.cache.js:1:880669

> [email protected] pack-zip
> (cp connector-spec.json ./dist/ && cd ./dist && bestzip $npm_package_name-$npm_package_version.zip ./index.js ./connector-spec.json)

'cp' is not recognized as an internal or external command,
operable program or batch file.

Hi Samira.

Looks like you’re using Windows command prompt, which doesn’t have support for the cd and cp commands used in that script. Try using PowerShell instead.

Samira,

You can change the package.json in the scripts section to the following and it will work:

    "pack-zip": "(copy connector-spec.json dist\\connector-spec.json && cd ./dist && bestzip %npm_package_name%-%npm_package_version%.zip ./index.js ./connector-spec.json)"
1 Like

Thanks Philip,
the cp command is fixed, but the first problem still is there
when it run the build command it shows the following error so it does not create any dist folder

> npx ncc build ./src/index.ts -o ./dist -m -C

ncc: Version 0.28.6
ncc: Compiling file index.js
ncc: Using [email protected] (local user-provided)
Error: error:0308010C:digital envelope routines::unsupported

In your package.json, try changing the typescript module to 4.7.4:

"typescript": "4.7.4"

Delete your “node_modules” directly, run npm install and try building again.

Thanks for your help