ERROR: '[Vue warn]: Failed to resolve directive: in testing - javascript

I am writing unit tests in a Vue 2.0 app using PhantomJS, Karma, Mocha and Chai and while the tests pass, I get a warning with each test that looks like this:
ERROR: '[Vue warn]: Failed to resolve directive: highlightjs
(found in <UnitTest>)
I would either like to find a way to ignore warnings about custom directives or somehow make the tests aware of them.
=== Possibly related, possibly separate error ===
When I force one of my tests to fail I am getting an error that looks like:
npm ERR! Darwin 16.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "unit"
npm ERR! node v7.6.0
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! vuestack#1.0.0 unit: `cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vuestack#1.0.0 unit script 'cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the vuestack package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs vuestack
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls vuestack
npm ERR! There is likely additional logging output above.
Other tests still pass but this error shows up when they've all run. Have tried uninstalling / reinstalling node modules, as well as switching Node versions around.

Doh! Solved:
import VueHighlightJS from 'vue-highlightjs'
Vue.use(VueHighlightJS);
I found the answer to the question here. Incidentally, a blog post by the creator of the component I was struggling with. Looks like you need to include custom components using Vue.use() in each separate testing file.

Related

When i run the npm run build for react project i am getting the error, please check below code

'REACT_APP_BUILD_ENV' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! argon-dashboard-pro-react#1.2.0 build: `react-csp dev && REACT_APP_BUILD_ENV='test' react-scripts build && gulp licenses`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the argon-dashboard-pro-react#1.2.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Shubham Jayswal\AppData\Roaming\npm-cache\_logs\2022-03-22T13_44_53_411Z-debug.log
I am trying to build my code but when I run npm run build with react project getting every time error, stuck there don't have an idea how to resolve that error, could please give me solution how to fix that error.
I am using Windows.
if on windows
change build in package.json to
react-csp dev && set REACT_APP_BUILD_ENV='test' react-scripts build && gulp licenses

Lerna adding command exits with the error of not related packages

I'm using lerna to manage my multirepo with packages that are relating to each other. I did not have this issue before instalation of a new opereating system. Now when I'm trying to use lerna add to add a dependency on package to package, it produces error with the mentioned packages that are not related to either the one that I'm targeting and the one that is a dependency.
Here is my console output:
[filip#filip-thinkpad platform]$ lerna add #devell-platform/webcomponents-base --scope=#devell-platform/web-manual
lerna notice cli v3.18.3
lerna notice filter including "#devell-platform/web-manual"
lerna info filter [ '#devell-platform/web-manual' ]
lerna info Adding #devell-platform/webcomponents-base in 1 package
lerna info Bootstrapping 26 packages
lerna info Installing external dependencies
lerna ERR! npm install exited 1 in '#devell-platform/model'
lerna ERR! npm install stderr:
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/#devell-platform%2fbase-types - Not found
npm ERR! 404
npm ERR! 404 '#devell-platform/base-types#0.0.0' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/filip/.npm/_logs/2020-09-27T13_19_58_840Z-debug.log
lerna ERR! npm install exited 1 in '#devell-platform/model'
lerna WARN complete Waiting for 3 child processes to exit. CTRL-C to exit immediately.
lerna ERR! npm install exited 1 in '#devell-platform/model'
lerna ERR! npm install stderr:
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/#devell-platform%2fbase-types - Not found
npm ERR! 404
npm ERR! 404 '#devell-platform/base-types#0.0.0' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/filip/.npm/_logs/2020-09-27T13_19_58_840Z-debug.log
lerna ERR! npm install exited 1 in '#devell-platform/model'
lerna WARN complete Waiting for 3 child processes to exit. CTRL-C to exit immediately.
The package #devell-platform/webcomponents-base has no dependency on either #devell-platform/model nor #devell-platform/base-types.
I tried various things, like deleting the model package, but then some other package
is displayed as the cause of the error.
There is no package #devell-platform/webcomponents-base. If it existed before, it must have been removed.
This has nothing to do with lerna but is just a coincidence. A plain install with npm install #devell-platform/webcomponents-base fails as well.

npm install errors out preinstall script

I needed to fix security vulnerabilities for knexnest > knex > minimist. The version for minimist did not get updated with npm audit fix or simple npm update. I followed this article and it updated the versions and gave a vulnerability score of 0. But now when I create a docker image (build) my repo, it fails at the preinstall script.
npx: installed 5 in 5.29s
EACCES: permission denied, open './package-lock.json'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-service#1.2.3 preinstall: `npx npm-force-resolutions`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-service#1.2.3 preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! /home/node/.npm/_logs/2020-07-15T09_56_56_625Z-debug.log
While installing modules locally on editor, no errors pop up. Please help!
I had the same error, I fixed it with
chmod 666 package-lock.json
This doesn't seem as a root cause solution, but it's a simple workaround.

How to host openlayer examples on a local server?

I have to use an older version of OpenLayers (4.6.2). The examples are really useful to try out and to copy paste from. However the web page with examples contains the latest version.
Is it possible to host OpenLayers examples locally?
What I tried:
checking out 4.6.2 version
npm install
npm run-script start --> Starts a server, but examples won't work
npm run-script transform --> Throws an error like below
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! openlayers#4.6.2 lint: eslint tasks test src examples transforms "--fix"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the openlayers#4.6.2 lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! D:\Users\liptak\AppData\Roaming\npm-cache_logs\2018-08-07T14_58_46_839Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! openlayers#4.6.2 transform: npm run changecase-src && npm run transform-src && npm run transform-examples && npm run transform-test && npm run lint -- --fix
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the openlayers#4.6.2 transform script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! D:\Users\liptak\AppData\Roaming\npm-cache_logs\2018-08-07T14_58_46_895Z-debug.log
I suppose it would need a specific version of Node and NPM to build, but I have no idea, how to find that out.
Can someone help me out here? Do I have to build OpenLayers, or there is a simpler solution to start up the examples?
You may try to build examples locally but instead of struggling with the local build system, you can simply access to old versions of OpenLayers API and examples.
To illustrated, for v4.6.2 (upgrade at least to v4.6.5) you can use http://openlayers.org/en/v4.6.2/examples/ and http://openlayers.org/en/v4.6.2/apidoc/
You just need to change in the url the OpenLayers version to get it

How can i change vue-tweet-embed npm packages, test and use it in my project?

How can i change vue-tweet-embed npm package, test and use it in my project.
i have tried to change it but not able to run or check (as describe in readme file).
i want to make changes for tweet that is not available or deleted then it should handle with some error message or image.
i am getting error like this:
'BABEL_ENV' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! Test failed. See above for more details.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-tweet-embed#1.1.1 prepublish: `npm test && npm run clean && npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-tweet-embed#1.1.1 prepublish script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\IO\AppData\Roaming\npm-cache\_logs\2017-06-29T09_33_32_460Z-debug.log

Categories

Resources