How to host openlayer examples on a local server? - javascript

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

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

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 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

Why won't my React Native app run on my device

I want to be able to test my app on Expo (an IPhone app used to test React Native code after you hit save) and I just can't seem to get past this error I'm getting Terminal. I've ran my app using Expo before with no problems but now after trying to include a Navigator in my app, I get an error.
First I did this:
$ npm i -g create-react-native-app
$ create-react-native-app my-project
$ cd my-project`
Then I wanted to include a Navigator in my app so I went ahead and did this:
npm install --save react-navigation
After that, in order to get Expo running I did:
npm start
When I do npm start, I get this error in Terminal:
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! Mestro#0.1.0 start: `react-native-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the Mestro#0.1.0 start 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:
my guess would be that you are using npm5, I would recommend using npm4, npm5 is currently (as of june 17, 2017) very buggy. see this recommendation in the README.

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

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.

Categories

Resources