相关文章推荐

I get this error when launching the dev server. Any ideas how to resolve this one?

ryan@m-c02cm0symd6r ccl1043 % snc ui-component develop --open
Running component locally...
Proxy server connecting to https://nowlearning-lpt0397125-001.lab.service-now.com
clean-webpack-plugin: /Users/ryan/ccl1043/dist is outside of the project root. Skipping...
 10% building modules 1/1 modules 0 active(node:86120) [DEP0131] DeprecationWarning: The legacy HTTP parser is deprecated.
(node:86120) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
(node:86120) DeprecationWarning: Tapable.apply is deprecated. Call apply on the plugin directly instead
ℹ 「wds」: Project is running at http://localhost:8081/
ℹ 「wds」: webpack output is served from /
ℹ 「wds」: Content not from webpack is served from /Users/ryan/ccl1043/dist, /Users/ryan/ccl1043/node_modules/sn-polyfills/dist
ℹ 「wds」: 404s will fallback to /index.html
 10% building modules 1/6 modules 5 active …sers/ryan/ccl1043/example/element.jsℹ 「wdm」: wait until bundle finished: /
 10% building modules 5/6 modules 1 active …sers/ryan/ccl1043/example/element.js✖ 「wdm」: TypeError: dep.getResourceIdentifier is not a function
    at addDependency (/Users/ryan/ccl1043/node_modules/@servicenow/cli-component-archetype-dev/node_modules/webpack/lib/Compilation.js:413:30)
    at iterationOfArrayCallback (/Users/ryan/ccl1043/node_modules/@servicenow/cli-component-archetype-dev/node_modules/webpack/lib/Compilation.js:88:3)
    at addDependenciesBlock (/Users/ryan/ccl1043/node_modules/@servicenow/cli-component-archetype-dev/node_modules/webpack/lib/Compilation.js:435:5)
    at Compilation.processModuleDependencies (/Users/ryan/ccl1043/node_modules/@servicenow/cli-component-archetype-dev/node_modules/webpack/lib/Compilation.js:446:4)
    at afterBuild (/Users/ryan/ccl1043/node_modules/@servicenow/cli-component-archetype-dev/node_modules/webpack/lib/Compilation.js:569:15)
    at /Users/ryan/ccl1043/node_modules/@servicenow/cli-component-archetype-dev/node_modules/webpack/lib/Compilation.js:613:11
    at callback (/Users/ryan/ccl1043/node_modules/@servicenow/cli-component-archetype-dev/node_modules/webpack/lib/Compilation.js:364:5)
    at /Users/ryan/ccl1043/node_modules/@servicenow/cli-component-archetype-dev/node_modules/webpack/lib/Compilation.js:404:12
    at handleParseResult (/Users/ryan/ccl1043/node_modules/@servicenow/cli-component-archetype-dev/node_modules/webpack/lib/NormalModule.js:458:12)
    at /Users/ryan/ccl1043/node_modules/@servicenow/cli-component-archetype-dev/node_modules/webpack/lib/NormalModule.js:480:6
    at /Users/ryan/ccl1043/node_modules/@servicenow/cli-component-archetype-dev/node_modules/webpack/lib/NormalModule.js:344:12
    at /Users/ryan/ccl1043/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/Users/ryan/ccl1043/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at iterateNormalLoaders (/Users/ryan/ccl1043/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
    at /Users/ryan/ccl1043/node_modules/loader-runner/lib/LoaderRunner.js:236:3
    at context.callback (/Users/ryan/ccl1043/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
/Users/ryan/ccl1043/node_modules/neo-async/async.js:16
    throw new Error('Callback was already called.');
Error: Callback was already called.
    at throwError (/Users/ryan/ccl1043/node_modules/neo-async/async.js:16:11)
    at /Users/ryan/ccl1043/node_modules/neo-async/async.js:2818:7
    at processTicksAndRejections (internal/process/task_queues.js:79:11)
ryan@m-c02cm0symd6r ccl1043 % 
						

Hi Ryan,

I'm not sure about this error. If you are getting odd errors which you can't trace back to changes you have made to the code, then sometimes it helps to re-import all of the dependencies.

To do this run npm install

If that doesn't work, try deleting the node_modules folder and running the npm install command again.

Let me know if you are still having issues.

Hi Ryan,

I'm not sure about this error. If you are getting odd errors which you can't trace back to changes you have made to the code, then sometimes it helps to re-import all of the dependencies.

To do this run npm install

If that doesn't work, try deleting the node_modules folder and running the npm install command again.

Let me know if you are still having issues.

If other people run into this issue, for me I had to reinstall my node version as well.
It seems that it had some conflicting packages. I'm using nvm to switch node modules.
Steps that worked for me are: 

nvm use node #switch 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!!

In this article I'm publishing some common issues you may encounter with the CLI / Custom Components

 
推荐文章