Gulp-notify compile error - gulp

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"
]
}
}

Related

ERROR in Entry module not found

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

SyntaxError: Unexpected token import when running test with Jest [REACT]

I am trying to build some tests that i have on my code, but i am not able to run it because it does not recognize the import statements.
when I run "npm test" to check my tests, i receive this error:
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import React from 'react'
^^^^^^
SyntaxError: Unexpected token import
at ScriptTransformer._transformAndBuildScript (node_modules/jest-cli/node_modules/jest-runtime/build/ScriptTransformer.js:289:17)
at <anonymous>
These are my .babelrc and package.json files:
package.json:
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"dev": "^0.1.3",
"react": "^15.6.1",
"react-google-button": "^0.3.0",
"react-google-login": "^2.9.2",
"react-google-login-component": "^0.7.0",
"react-native-google-signin": "^0.10.0",
"react-redirect": "^1.0.0",
"react-router-dom": "^4.1.2",
"react-scripts": "0.9.5"
},
"devDependencies": {
"babel-jest": "^20.0.3",
"babel-plugin-transform-es2015-modules-commonjs": "^6.24.1",
"enzyme": "^2.9.1",
"enzyme-to-json": "^1.5.1",
"identity-obj-proxy": "^3.0.0",
"jest-cli": "^20.0.4",
"react-addons-test-utils": "^15.6.0",
"react-dom": "^15.6.1"
},
"jest": {
"transform": {}
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "jest",
"eject": "react-scripts eject"
}
}
.babelrc:
{
"plugins":["transform-react-jsx"],
"presets": ["es2015", "react"],
"env": {
"test": {
"plugins": ["transform-es215-modules-commonjs"]
}
}
}

How to include extension on my package.json file

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

npm install that loads dependency with package.json as authored

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.

ReferenceError: [BABEL] unknown: Using removed Babel 5 option: base.blacklist

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? :(