I want to include this extension ol3-layerswitcher on my package.json file
My package.json:
{
"name": "TEST",
"version": "1.0.0",
"description": "OpenLayers 3",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "beefy app.js:bundle.js --live",
"compile:dev": "./node_modules/.bin/browserify app.js -o bundle.js",
"compile:prod": "./node_modules/.bin/browserify app.js | uglifyjs > bundle.js"
},
"author": "test",
"license": "MIT",
"dependencies": {
"jquery": "^3.1.0",
"jquery-ui": "^1.12.0",
"openlayers": "^3.17.1",
"ol3-layerswitcher": "^1.0.2"
},
"devDependencies": {
"browserify": "^13.0.0",
"uglify-js": "^2.7.0",
"beefy": "^2.1.8"
}
}
add this line :
"dependencies": {
"jquery": "^3.1.0",
"jquery-ui": "^1.12.0",
"ol3-layerswitcher": "git://github.com/walkermatt/ol3-layerswitcher.git",
"openlayers": "^3.17.1"
}
Related
This is the error:
SyntaxError: Unexpected token } in JSON at position 322. But JSON file
is correct.
JSON file:
{
"name": "gl",
"version": "1.0.0",
"description": "GL online CV",
"main": "index.html",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Alex Guzhyk",
"license": "ISC",
"dependencies": {
"express": "^4.16.2",
"react": "^16.1.1",
"react-dom": "^16.1.1",
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-env": "^1.6.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"webpack": "^3.8.1",
}
}
Validate your JSON to know if the format is correct.
Remove the trailing comma at the end of the collection.
{
"name": "gl",
"version": "1.0.0",
"description": "GL online CV",
"main": "index.html",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Alex Guzhyk",
"license": "ISC",
"dependencies": {
"express": "^4.16.2",
"react": "^16.1.1",
"react-dom": "^16.1.1"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-env": "^1.6.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"webpack": "^3.8.1"
}
}
You can check it here:
https://jsonlint.com/
In JSON, you can not have a trailing comma.
Incorrect usage
"person": {
"age": 31,
"gender": "male",
}
Unlike javascript, JSON is a strict data format which is not javascript! It has only been derived from it.
Therefore in JSON, you are not allowed to add a trailing comma.
Correct usage
"person": {
"age": 31,
"gender": "male"
}
I tried gulp-htmlmin and some other packages for minify html but can't minify my html files.
cmd err
my package.josn:
{
"name": "asb-with-gulp",
"version": "1.0.0",
"description": "",
"main": "gulpfile.js",
"dependencies": {
"gulp": "^3.9.1",
"gulp-sass": "^3.1.0",
"gulp-scss": "^1.4.0"
},
"devDependencies": {
"gulp-clean-css": "^3.3.1",
"gulp-concat": "^2.6.1",
"gulp-concat-css": "^2.3.0",
"gulp-concat-js": "^0.1.0",
"gulp-html-minifier": "^0.1.8",
"gulp-htmlmin": "^3.0.0",
"gulp-minifier": "^0.2.2",
"gulp-sort": "^2.0.0",
"gulp-uglify": "^2.1.2",
"pump": "^1.0.2"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Gilas Software Team",
"license": "ISC"
}
I noticed that when viewing a package.json under node_modules, I see JSON that looks like:
{
"_args": [
[
"example#0.2.0",
"C:\\path\\to\\project\\folder"
]
],
"_from": "example#0.2.0",
"_id": "example#0.2.0",
"_inCache": true,
"_installable": true,
"_location": "/example",
"_nodeVersion": "6.2.0",
"_npmUser": {},
"_npmVersion": "3.8.9",
"_phantomChildren": {},
"_requested": {
"name": "example",
"raw": "example#0.2.0",
"rawSpec": "0.2.0",
"scope": "#edf",
"spec": "0.2.0",
"type": "version"
},
"_requiredBy": [
"/"
],
"_resolved": "http://internal.registry/example/-/example-0.2.0.tgz",
"_shasum": "b564b263db925ff3a8bffdc922c16f8e4b6f4641",
"_shrinkwrap": null,
"_spec": "example#0.2.0",
"_where": "C:\\path\\to\\project\\folder",
"author": {
"name": "NPM User"
},
"dependencies": {
"gulp": "^3.9.1",
"gulp-concat": "^2.6.0",
"gulp-less": "^3.1.0"
},
"description": "Example Package",
"devDependencies": {},
"dist": {
"shasum": "b564b263db925ff3a8bffdc922c16f8e4b6f4641",
"tarball": "http://internal.registry/example/-/example-0.2.0.tgz"
},
"main": "index.js",
"name": "example",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"readmeFilename": "README.md",
"scripts": {
"postinstall": "gulp"
},
"version": "0.2.0"
}
Instead of just:
{
"name": "example",
"version": "0.2.0",
"description": "Example Package",
"main": "index.js",
"scripts": {
"postinstall": "gulp"
},
"author": "NPM User",
"dependencies": {
"gulp": "^3.9.1",
"gulp-concat": "^2.6.0",
"gulp-less": "^3.1.0"
}
}
Is there a command-line argument I can specify to keep dependency package.json files as authored when installing, or is there another way I can access the file as authored when there is no repository specified for the package?
I found an option called proprietary-attribs on the npm-config documentation but I don't think that's what I'm looking for.
I'm getting this error while running my gulpfile. I'm assuming that there's something wrong with my Babel version.
Here is my package.json
{
"name": "riotjs-es6-structure",
"version": "1.0.0",
"description": "",
"main": "gulpfile.js",
"dependencies": {},
"devDependencies": {
"babel-core": "^6.10.4",
"babel-preset-es2015": "^6.9.0",
"babelify": "^7.3.0",
"browserify": "^13.0.1",
"graceful-fs": "^4.1.4",
"gulp": "^3.9.1",
"gulp-livereload": "^3.8.1",
"gulp-plumber": "^1.1.0",
"gulp-riot": "^0.5.1",
"gulp-sourcemaps": "^1.6.0",
"gulp-uglify": "^1.5.4",
"riot": "^2.4.1",
"riotify": "^1.0.1",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
This is my .babelrc file
{
"presets": ["es2015"]
}
What did I miss? :(
I am using gulpfile.js but it is throwing compile time error for gulp-notify
Following is structure of package.json
{
"name": "flux-pricing",
"version": "0.0.1",
"description": "Pricing component with flux",
"main": "gulpfile.js",
"dependencies": {
"flux": "^2.0.0",
"react": "^0.12.0",
"underscore": "^1.7.0"
},
"devDependencies": {
"envify": "~1.2.1",
"browserify": "~4.2.0",
"gulp": "~3.9.0",
"gulp-notify": "~1.4.0",
"gulp-util": "~2.2.19",
"reactify": "~0.13.1",
"vinyl-source-stream": "~0.1.1",
"watchify": "~0.10.2"
},
"scripts": {
"start": "watchify -o js/bundle.js -v -d .",
"build": "browserify . | uglifyjs -cm > js/bundle.min.js"
},
"author": "Ken Wheeler",
"browserify": {
"transform": [
"reactify",
"envify"
]
}
}