The Now Platform® Washington DC release is live. Watch now!

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Arnoud Kooi
ServiceNow Employee
ServiceNow Employee

Unable fo find task

If you find this article, I hope it will save you some troubleshooting time!
When you try to test a component you would use the command:

snc ui-component develop

You may run into the following error:

throw new Error("Unable to find task for: " + cmd);

This error occurs in file /node_modules/builder/lib/task.js. This may likely happen in an existing component you got shared from a peer, where a newly scaffolded component works fine.

Probably you are missing a file .builderrc in the root of your component folder. Best to check with the source if the original file is present. For a new scaffolded component the content of the file is:

---
archetypes:
  - "@servicenow/cli-archetype"
  - "@servicenow/cli-component-archetype"

This may work as well :). After having the file in place I recommend running the following terminal command from the VS Code folder:

rm -rf node_modules && rm package-lock.json && npm i

This will make sure you "clean" and reinstall your node packages.

I hope this saves you the troubleshooting time I put in 🙂 Let me know if so!
I plan to update this article when I have more knowledge to share in regards to the CLI / Components!

 

Download CLI

The CLI is available for download via the Store, if you do not have access, please use this GitHub Link the download link is at the bottom of the page.

 

Version Not Supported

When deploying to the latest version you may see for example:

Instance version "Sandiego" unsupported!
 
You can work around this by editing two files:
  • ~/.snc/.extensions/ui-component/node_modules/@servicenow/cli-glide/support/index.js
  • [your component directory]/node_modules/@servicenow/cli-glide/support/index.js
 Add the release family name as follows to the array
let s=["paris","quebec","rome", "sandiego"];

Both of these files are identical, and you just need to edit them in the same way.
Alternatively, you can re-run the npm install command after updating the first one. Once done this newly created component should be ok 🙂

 
Error: Callback was already called
When the above error occurs, you may want to first check this thread.
If that does not work you may have conflicting packages globally installed.
 
I'm using nvm to switch node modules.
Steps that worked for me are: 
nvm use node #switch node version so your not using version to uninstall
nvm uninstall v12.22.9 #uninstall
nvm install v12.22.9 #reinstall
nvm use v12.22.9 #use correct version
rm -rf node_modules && rm package-lock.json #cleanup all old node stuff
node install #reinstalll
snc ui-component develop #hope it works now!!
 

 

Comments
Yusuf5
Giga Expert

Thanks Arnoud,

How do we download the snc?

Regards,

Yusuf

MattSN
Kilo Sage
Kilo Sage
Arnoud Kooi
ServiceNow Employee
ServiceNow Employee

Thank you, your link has some trailing characters, will add it to the article

MattSN
Kilo Sage
Kilo Sage

Good catch. Fixed characters.

Yusuf5
Giga Expert

Thanks Matt,

But we are not allowed to download, it requires a HI account.

Regards,

Yusuf

Arnoud Kooi
ServiceNow Employee
ServiceNow Employee

Matt provided the GitHub link, read the page and try.

Jamison Cote1
Tera Contributor

Hi there,

 

I've run into the following, but installing node 12.16.1 doesn't seem to help. 

 

Also don't know why we'd install a node version that's a few years old.

 

When I run:

snc ui-component develop

 

I get the following error:

Running component locally...
/Users/jcote/.snc/.extensions/ui-component/node_modules/builder/lib/task.js:166
throw new Error("Unable to find task for: " + cmd);
^

Error: Unable to find task for: develop:trace
at module.exports.Task.getRunParams (/Users/jcote/.snc/.extensions/ui-component/node_modules/builder/lib/task.js:166:11)
at module.exports.Task.run (/Users/jcote/.snc/.extensions/ui-component/node_modules/builder/lib/task.js:375:21)
at module.exports.Task.execute (/Users/jcote/.snc/.extensions/ui-component/node_modules/builder/lib/task.js:605:15)
at module.exports (/Users/jcote/.snc/.extensions/ui-component/node_modules/builder/bin/builder-core.js:57:8)
at Object.<anonymous> (/Users/jcote/.snc/.extensions/ui-component/node_modules/builder/bin/builder.js:43:1)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)

 

This is what the directory looks like:

index.js                node_modules            package-lock.json       package.json

 

sameer_shinde
Tera Contributor

I'm not able to create a project using snc ui-component project command I'm trying to create project on Utah release. 

When I run the command gives the below output

 

Could not find an active connection to a ServiceNow instance.

 

When I try to run login command like

>snc ui-component login https://myinstance/ basic mysername mypassword

 

I get below output

 

Instance version "Utah" unsupported!

ArjunBasnet
Tera Expert

Thanks @Arnoud Kooi the "clean" install of packages did help, although I was experiencing different issue. I was trying to build custom component utilizing ServiceNow base component and faced following issues.

 

You may need an additional loader to handler the result of these loaders

 

ERROR in ../node_modules/@servicenow/now-typeahead/src/now-typeahead.js 141:2
Module parse failed: Unexpected token (141:2)
File was processed with these loaders:
* ../node_modules/source-map-loader/index.js
You may need an additional loader to handle the result of these loaders.
|
| return (
> <Fragment>
| {renderFormFieldLabel(
| componentId,
@ ../node_modules/@servicenow/now-typeahead/src/index.js 1:0-25
@ ../src/x-532056-ref-input/index.js
@ ./element.js

ERROR in ../node_modules/@servicenow/now-typeahead/src/now-typeahead-multi.js 167:3
Module parse failed: Unexpected token (167:3)
File was processed with these loaders:
* ../node_modules/source-map-loader/index.js
You may need an additional loader to handle the result of these loaders.
| : undefined;
| return item ? (
> <div key={item.id} className="now-pill-grid-container" role="row">
| <div className="now-pill-grid-container" role="gridcell">
| <now-pill

 After looking into theses error one would start to blame Webpack underneath being too old or not allowing to configure or extend the webpack configuration.

kotiswaroop
Tera Expert

Hi Arjun,

 

Analysis and resolution to the error 'You may need an additional loader to handler the result of these loaders':

 

Root cause: The error occurs when build step passes more modern code than is supported by the specified browsers.

 

Resolution: 

 

Step1:

To solve this issue , go topackage.json file and set browserslist property

 

kotiswaroop_0-1697367478034.png

 

step 2: clear the cache

npm cache clean -f

 

step 3:

Delete the node_modules and reinstall them. 
Not sure about your OS. Execute the following lines of code in terminal

mac and linux:

rm -rf node_modules
rm -f package-lock.json
npm cache clean --force

npm install

 

windows:

rd /s /q "node_modules"
del package-lock.json
npm cache clean --force

npm install

 

It should solve the issue.

 

Happy coding

ArjunBasnet
Tera Expert

Hi Swaroop,

 

Thanks for the resolution, will try the approach when faced with issue again. However, I was able to resolve the issue by deleting "node_modules" folder and doing the reinstallation. 



Regards,

Arjun

Rahman4
Giga Guru

Hi all,

This is 2024 and still the CLI is not working properly! I am installing the CLI to my new laptop after 2+ years where I managed to successfully install it in my old laptop.

 

When I execute this command: 

snc extension add --name ui-component

I get SNC is not recognized as internal or external command and fails. I can confirm that NOW-CLI is installed successfully and version is  24.0.1. I have tried NVM to set the version to 14 before running the above command, I have ran the command from command line or VS Code Terminal and still same issue. I have re-installed the now CLI.

npm i -g @servicenow/cli

Still same issue.

 

I am following this great article here: https://jessems.com/posts/2023-02-16-setting-up-local-environment-now-experience-custom-component-de...

 

any feedback will be appreciated.

 

many thanks

Version history
Last update:
‎02-17-2022 02:25 PM
Updated by: