SyntaxError: Unexpected token 'const' -- despite the fact that I replaced const - node.js

I'm trying to export my firebase app so I can call it inside of mocha test specs as well as within the source code I'm trying to test.
My Mocha test spec looks like this:
import Vue from 'vue'
import Edit from '#/components/Edit'
import filedata from '../../../static/filedata.js'
import submitFile from '../../../helpers/submitFile.js'
import firebaseapp from '../../../src/db.js'
var db = firebaseapp.database()
var storage = firebaseapp.storage()
describe('Edit.vue', () => {
it('should let me add files without choosing a category', () => {
// add files to appear on the homepage
var Constructor = Vue.extend(Edit)
var vm = new Constructor().$mount()
console.log(filedata + ' is the file data')
var ref = storage.ref('categories')
console.log(ref)
submitFile(filedata)
}) ...
And the submitFile file looks like this:
var firebaseapp = require('../src/db.js')
console.log('the app is: ' + firebaseapp)
var db = firebaseapp.database()
var storage = firebaseapp.storage()
module.exports = function(files){
// is the function being called from the test environment?
if(files){
console.log(files)
}
else {
// function called from src -- files were null
var files = this.$refs.upload.uploadFiles;
}
var storageRef = storage.ref();
var pdfsRef = storageRef.child('files');
// var self = this;
console.log('the files length is ' + files.length)
files.forEach(function(file){
var file = file['raw'];
var name = file['name']
var fileref = storageRef.child(name);
var uploadTask = fileref.put(file);
uploadTask.then(function(snapshot){
console.log('uploaded');
var url = snapshot.downloadURL;
self.gettext(url, name);
});
try {
uploadTask.on('state_changed', function(snapshot){
// Observe state change events such as progress, pause, and resume
// Get task progress, including the number of bytes uploaded and the total number of bytes to be uploaded
self.uploadProgress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
console.log(self.uploadProgress + ' is the upload progress.');
switch (snapshot.state) {
case app.storage.TaskState.PAUSED: // or 'paused'
console.log('Upload is paused');
break;
case app.storage.TaskState.RUNNING: // or 'running'
console.log('Upload is running');
break;
}
}, function(error) {
// Handle unsuccessful uploads
}, function() {
// Handle successful uploads on complete
// For instance, get the download URL: https://firebasestorage.googleapis.com/...
var downloadURL = uploadTask.snapshot.downloadURL;
});
}
catch(e){
console.log(e)
}
})
}
Lastly, here's what db.js looks like:
var Firebase = require('firebase')//import Firebase from 'firebase'
var config = {
...
};
var app = Firebase.initializeApp(config) /// USED TO BE CONST APP
export default app
What's very strange is that when I run npm run unit, I get an error telling me that const is not recognized.
SyntaxError: Unexpected token 'const'
at webpack:///src/db.js~:11:0 <- index.js:38182
So I went through my db.js file and changed const to var, and I'm getting the exact same error*, no matter how I change the file.
Does anyone have any idea what could be going on?
Here's my package.json
{
...
"private": true,
"scripts": {
"dev": "node build/dev-server.js",
"start": "node build/dev-server.js",
"build": "node build/build.js",
"unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
"e2e": "node test/e2e/runner.js",
"prepare": "node ./helpers/gettestfiles.js",
"test": "npm run prepare && npm run unit && npm run e2e && cd ../neuhold-front && npm run unit && npm run e2e",
"deploy": "npm run build && firebase deploy"
},
"dependencies": {
"babel-loader": "^7.1.2",
"babel-preset-es2015": "^6.24.1",
"element-ui": "^1.4.2",
"firebase": "^4.3.0",
"pdfjs-dist": "^1.9.450",
"vue": "^2.3.3",
"vue-awesome": "^2.3.1",
"vuefire": "^1.4.3"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
"babel-loader": "^7.1.1",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.22.0",
"chalk": "^2.0.1",
"connect-history-api-fallback": "^1.3.0",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.0",
"cssnano": "^3.10.0",
"eventsource-polyfill": "^0.9.6",
"express": "^4.14.1",
"extract-text-webpack-plugin": "^2.0.0",
"file-loader": "^0.11.1",
"friendly-errors-webpack-plugin": "^1.1.3",
"html-webpack-plugin": "^2.28.0",
"http-proxy-middleware": "^0.17.3",
"webpack-bundle-analyzer": "^2.2.1",
"cross-env": "^5.0.1",
"karma": "^1.4.1",
"karma-coverage": "^1.1.1",
"karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.2",
"karma-phantomjs-shim": "^1.4.0",
"karma-sinon-chai": "^1.3.1",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "0.0.31",
"karma-webpack": "^2.0.2",
"lolex": "^1.5.2",
"mocha": "^3.2.0",
"chai": "^3.5.0",
"sinon": "^2.1.0",
"sinon-chai": "^2.8.0",
"inject-loader": "^3.0.0",
"babel-plugin-istanbul": "^4.1.1",
"phantomjs-prebuilt": "^2.1.14",
"chromedriver": "^2.27.2",
"cross-spawn": "^5.0.1",
"nightwatch": "^0.9.12",
"selenium-server": "^3.0.1",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"opn": "^5.1.0",
"optimize-css-assets-webpack-plugin": "^2.0.0",
"ora": "^1.2.0",
"rimraf": "^2.6.0",
"url-loader": "^0.5.8",
"vue-loader": "^12.1.0",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.3.3",
"webpack": "^2.6.1",
"webpack-dev-middleware": "^1.10.0",
"webpack-hot-middleware": "^2.18.0",
"webpack-merge": "^4.1.0"
},
"engines": {
"node": ">= 4.0.0",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
build/webpack.dev.conf.js
var utils = require('./utils')
var webpack = require('webpack')
var config = require('../config')
var merge = require('webpack-merge')
var baseWebpackConfig = require('./webpack.base.conf')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
// add hot-reload related code to entry chunks
Object.keys(baseWebpackConfig.entry).forEach(function (name) {
baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
})
module.exports = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
},
// cheap-module-eval-source-map is faster for development
devtool: '#cheap-module-eval-source-map',
plugins: [
new webpack.DefinePlugin({
'process.env': config.dev.env
}),
// https://github.com/glenjamin/webpack-hot-middleware#installation--usage
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
// https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true
}),
new FriendlyErrorsPlugin()
]
})
To show that I'm not mistakenly editing different repos ...
macbook001:docu-repo josephadmin$ cd neuhold-back
macbook001:neuhold-back josephadmin$ cd ..
macbook001:docu-repo josephadmin$ cd neuhold-back/src
macbook001:src josephadmin$ ls
App.vue assets components db.js db.js~ main.js
macbook001:src josephadmin$ cat db.js
/* eslint-disable */
import Firebase from 'firebase'
var config = {
...
};
var app = Firebase.initializeApp(config)
export default app
macbook001:src josephadmin$ cd ../ && npm run unit
> neuhold-back#0.1.0 unit /Users/josephadmin/production/docu-repo/neuhold-back
> cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run
28 08 2017 12:45:41.353:INFO [karma]: Karma v1.7.0 server started at http://0.0.0.0:9876/
28 08 2017 12:45:41.357:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
28 08 2017 12:45:41.376:INFO [launcher]: Starting browser PhantomJS
28 08 2017 12:45:42.504:INFO [PhantomJS 2.1.1 (Mac OS X 0.0.0)]: Connected on socket ... with id 994129
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
SyntaxError: Unexpected token 'const'
at webpack:///src/db.js~:11:0 <- index.js:38108
PhantomJS 2.1.1 (Mac OS X 0.0.0): Executed 0 of 0 ERROR (0.65 secs / 0 secs)
PhantomJS 2.1.1 (Mac OS X 0.0.0): Executed 0 of 0 ERROR (0 secs / 0 secs)
=============================== Coverage summary ===============================
Statements : 100% ( 0/0 )
Branches : 100% ( 0/0 )
Functions : 100% ( 0/0 )
Lines : 100% ( 0/0 )
================================================================================
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "unit"
npm ERR! node v7.10.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! neuhold-back#0.1.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 neuhold-back#0.1.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 neuhold-back 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 neuhold-back
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls neuhold-back
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/josephadmin/.npm/_logs/2017-08-28T10_45_43_361Z-debug.log
macbook001:neuhold-back josephadmin$

From the looks of the error thrown, this seems like a problem with PhantomJS cache. Check this Stack Overflow post right here.

Related

Bitbucket pipelines throws error package is not defined while running test cases

I want to run test cases when I push something on branch. For that I have created bitbucket-pipelines.yml file with the following configuration:
image: node:10.15.3
pipelines:
default:
- step:
script:
- cd functions
- node -v
- npm install
- ls
- npm run lint
- npm run test:bitbucket
- npm run build
But while running this, I always get error on npm run test:bitbucket which says express is not defined. I even ran ls command and found out that node_modules folder is present and also express package is present.
> functions# test:bitbucket /opt/atlassian/pipelines/agent/build/functions
> NODE_ENV=test_bitbucket jest --coverage
FAIL src/__tests__/accessToken.test.ts
● Test suite failed to run
ReferenceError: express is not defined
12 | }
13 |
> 14 | const app = express.default();
| ^
15 | app.use(express.urlencoded({ extended: true }));
16 | app.use(express.json());
17 | app.use(cors());
at Object.<anonymous> (src/app.ts:14:13)
at Object.<anonymous> (src/__tests__/accessToken.test.ts:3:1)
----------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files | 0 | 0 | 0 | 0 |
----------|---------|----------|---------|---------|-------------------
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 5.994 s
Ran all test suites.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions# test:bitbucket: `NODE_ENV=test_bitbucket jest --coverage`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the functions# test:bitbucket 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! /root/.npm/_logs/2022-06-20T11_30_55_383Z-debug.log
package.json file
{
"name": "functions",
"scripts": {
"lint": "tslint --project tsconfig.json",
"build": "tsc",
"build:watch": "tsc -w ",
"dev": "NODE_ENV=development tsc && node lib/server.js",
"serve": "npm run build && firebase emulators:start --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions:connect_foodpanda_auth_apis_dev",
"logs": "firebase functions:log",
"server": "cd src && nodemon server.ts -e ts,json,yaml",
"test": "jest --coverage",
"test:watch": "jest --watch",
"test:bitbucket": "NODE_ENV=test_bitbucket jest --coverage"
},
"jest": {
"testMatch": [
"<rootDir>/src/**/*.(test).{js,ts}",
"<rootDir>/src/**/?(*.)(spec|test).{js,ts}"
],
"preset": "ts-jest",
"setupFiles": [
"<rootDir>/src/setup-tests.ts"
]
},
"engines": {
"node": "10"
},
"main": "lib/index.js",
"dependencies": {
"#google-cloud/secret-manager": "^3.2.0",
"#google-cloud/tasks": "^2.1.2",
"axios": "^0.21.0",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"express-openapi-validator": "^4.13.7",
"express-paginate": "^1.0.2",
"firebase-admin": "^9.3.0",
"firebase-functions": "^3.6.1",
"http-status-codes": "^2.1.4",
"jest": "^27.5.1",
"joi": "^17.3.0",
"jsonwebtoken": "^8.5.1",
"promise-mysql": "^4.1.3",
"supertest": "^6.2.3",
"swagger-ui-express": "^4.3.0",
"ts-jest": "^27.1.5",
"uuid": "^8.3.1",
"winston": "^3.3.3",
"yamljs": "^0.3.0"
},
"devDependencies": {
"#types/cors": "^2.8.12",
"#types/dotenv": "^8.2.0",
"#types/express": "^4.17.8",
"#types/express-paginate": "^1.0.0",
"#types/http-status-codes": "^1.2.0",
"#types/jest": "^27.4.1",
"#types/jsonwebtoken": "^8.5.0",
"#types/node": "^14.14.6",
"#types/supertest": "^2.0.12",
"#types/swagger-ui-express": "^4.1.3",
"#types/uuid": "^8.3.0",
"#types/winston": "^2.4.4",
"#types/yamljs": "^0.2.31",
"#typescript-eslint/eslint-plugin": "^4.6.1",
"#typescript-eslint/parser": "^4.6.1",
"eslint": "^7.12.1",
"eslint-plugin-import": "^2.22.1",
"firebase-functions-test": "^0.2.0",
"nodemon": "^2.0.6",
"ts-node": "^9.0.0",
"tslint": "^5.12.0",
"typescript": "^3.9.7"
},
"private": true
}
app.ts file
import cors from 'cors';
import errorMiddleware from './middlewares/error.middleware';
import routes from './routes/routes';
import * as express from 'express';
import swaggerUI from 'swagger-ui-express';
import yaml from 'yamljs';
import path from "path";
import * as OpenApiValidator from 'express-openapi-validator';
import * as dotenv from 'dotenv';
if (process.env.NODE_ENV !== "test_bitbucket") {
dotenv.config();
}
const app = express.default();
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
app.use(cors());
// Serve the OpenAPI spec
const swaggerJsDocs = yaml.load(path.resolve(__dirname, "../api.yaml"));
app.use('/docs', swaggerUI.serve, swaggerUI.setup(swaggerJsDocs));
app.use(
OpenApiValidator.middleware({
apiSpec: path.resolve(__dirname, "../api.yaml"),
validateRequests: true,
})
);
app.use('/oauth', routes);
app.use(errorMiddleware);
export default app;
I am not able to identify issue, Any help is appreciated. Thank you.

Deploying Svelte App to Heroku / Dokku fails because modules cannot be found

I am having problems deploying my svelte web3 App to my VPS running Dokku.
The structure of the folder is as follows:
root
|-->svelte
|--> ...
I found some solutions to work with the two folders needing npm install around here. So I put:
"heroku-postbuild": "cd ./svelte && npm install && npm run build" and "cacheDirectories": ["./node_modules", "./svelte/node_modules"] in the root package.json.
But when the process comes to this point it fails with the following error:
remote: [!] Error: Cannot find module '#rollup/plugin-node-resolve'
remote: Require stack:
remote: - /tmp/build/svelte/rollup.config.js
remote: - /tmp/build/svelte/node_modules/rollup/dist/shared/loadConfigFile.js
remote: - /tmp/build/svelte/node_modules/rollup/dist/bin/rollup
I've tried changing the import to include the full paths etc. but nothing has worked so far. I have also changed the order of the imports, but the process fails with the first import in the rollup.config.
Any ideas?
package.json root:
"scripts": {
"heroku-postbuild": "cd ./svelte && npm install && npm run build"
},
"dependencies": {
"#openzeppelin/contracts": "^4.6.0",
"#truffle/hdwallet-provider": "^2.0.8",
"babel-polyfill": "^6.26.0",
"babel-register": "^6.26.0",
"dotenv": "^16.0.0",
"web3": "^1.7.3"
},
"cacheDirectories": ["./node_modules", "./svelte/node_modules"],
"engines": {
"node": "16.14",
"npm": "8.7.x"
}
}
package.json svelte (added all the dev dependencies again just in case)
{
"name": "app",
"version": "1.0.0",
"private": true,
"scripts": {
"build": "rollup -c",
"dev": "rollup -c -w",
"start": "sirv public --no-clear"
},
"devDependencies": {
"#rollup/plugin-commonjs": "^17.0.0",
"#rollup/plugin-node-resolve": "^11.0.0",
"rollup": "^2.3.4",
"rollup-plugin-css-only": "^3.1.0",
"rollup-plugin-livereload": "^2.0.0",
"rollup-plugin-svelte": "^7.0.0",
"rollup-plugin-terser": "^7.0.0",
"svelte": "^3.0.0"
},
"dependencies": {
"rollup-plugin-terser": "^7.0.0",
"svelte": "^3.0.0",
"#rollup/plugin-commonjs": "^17.0.0",
"#rollup/plugin-node-resolve": "^11.0.0",
"rollup-plugin-css-only": "^3.1.0",
"rollup": "^2.3.4",
"rollup-plugin-svelte": "^7.0.0",
"#rollup/plugin-json": "^4.1.0",
"apexcharts": "^3.35.0",
"bootstrap": "^5.1.3",
"moment": "^2.29.2",
"rollup-plugin-copy": "^3.4.0",
"sirv-cli": "^2.0.0",
"svelte-web3": "^3.4.0"
}
}
rollup.config.js
import resolve from '#rollup/plugin-node-resolve';
import { nodeResolve } from '#rollup/plugin-node-resolve';
import svelte from 'node_modules/rollup-plugin-svelte';
import commonjs from 'node_modules/#rollup/plugin-commonjs';
import livereload from 'node_modules/rollup-plugin-livereload';
import { terser } from 'node_modules/rollup-plugin-terser';
import css from 'node_modules/rollup-plugin-css-only';
import json from 'node_modules/#rollup/plugin-json';
import copy from 'node_modules/rollup-plugin-copy'
const production = !process.env.ROLLUP_WATCH;
function serve() {
let server;
function toExit() {
if (server) server.kill(0);
}
return {
writeBundle() {
if (server) return;
server = require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], {
stdio: ['ignore', 'inherit', 'inherit'],
shell: true
});
process.on('SIGTERM', toExit);
process.on('exit', toExit);
}
};
}
export default {
input: 'src/main.js',
output: {
sourcemap: true,
format: 'iife',
name: 'app',
file: 'public/build/bundle.js'
},
plugins: [
svelte({
compilerOptions: {
// enable run-time checks when not in production
dev: !production
}
}),
// we'll extract any component CSS out into
// a separate file - better for performance
css({ output: 'bundle.css' }),
// If you have external dependencies installed from
// npm, you'll most likely need these plugins. In
// some cases you'll need additional configuration -
// consult the documentation for details:
// https://github.com/rollup/plugins/tree/master/packages/commonjs
resolve({
browser: true,
dedupe: ['svelte']
}),
commonjs(),
json(),
nodeResolve(),
copy({
targets: [{
src: './node_modules/bootstrap/dist/**/*',
dest: 'public/vendor/bootstrap'
}]
}),
// In dev mode, call `npm run start` once
// the bundle has been generated
!production && serve(),
// Watch the `public` directory and refresh the
// browser on changes when not in production
!production && livereload('public'),
// If we're building for production (npm run build
// instead of npm run dev), minify
production && terser()
],
watch: {
clearScreen: false
}
};
```

Angular Universal get domain name: Property 'req' does not exist on type 'object'

First of all, thanks stackoverflow provide this platform to ask questions, and also thanks to people who spend their time to help.
I am quiter new in angular. I have an angular universal project, more than one domains point to that hosting server, I want to load different content based on domain name. So I need to get domain name in angular component.
I have tried solution from stackoverflow, but I get error when I add below code:
app.engine('html', (_, options, callback) => {
let engine = ngExpressEngine({
bootstrap: AppServerModuleNgFactory,
providers: [
{ provide: 'request', useFactory: () => options.req, deps: [] },
provideModuleMap(LAZY_MODULE_MAP)
]
});
engine(_, options, callback);
});
My error is
TS2339: Property 'req' does not exist on type 'object'.
Property 'req' does not exist on type 'object'.ts(2339)
Argument of type 'object' is not assignable to parameter of type 'RenderOptions'.
Type '{}' is missing the following properties from type 'RenderOptions': req, bootstrapts(2345)
My quesion is how to make this options.req work? I do not know do I miss any dependencies or something els?
server.ts:
import 'zone.js/dist/zone-node';
import {enableProdMode} from '#angular/core';
// Express Engine
import {ngExpressEngine} from '#nguniversal/express-engine';
// Import module map for lazy loading
import {provideModuleMap} from '#nguniversal/module-map-ngfactory-loader';
import * as express from 'express';
import {join} from 'path';
// Faster server renders w/ Prod mode (dev mode never needed)
enableProdMode();
// Express server
export const app = express();
const PORT = process.env.PORT || 4000;
const DIST_FOLDER = join(process.cwd(), 'dist/browser');
// * NOTE :: leave this as require() since this file is built Dynamically from webpack
const {AppServerModuleNgFactory, LAZY_MODULE_MAP} = require('./dist/server/main');
// app.engine('html', ngExpressEngine({
// bootstrap: AppServerModuleNgFactory,
// providers: [
// provideModuleMap(LAZY_MODULE_MAP)
// ]
// }));
app.engine('html', (_, options, callback) => {
let engine = ngExpressEngine({
bootstrap: AppServerModuleNgFactory,
providers: [
{ provide: 'request', useFactory: () => options.req, deps: [] },
provideModuleMap(LAZY_MODULE_MAP)
]
});
engine(_, options, callback);
});
app.set('view engine', 'html');
app.set('views', DIST_FOLDER);
// Example Express Rest API endpoints
// app.get('/api/**', (req, res) => { });
// Serve static files from /browser
app.get('*.*', express.static(DIST_FOLDER, {
maxAge: '1y'
}));
// All regular routes use the Universal engine
app.get('*', (req, res) => {
res.render('index', { req });
});
package.json
{
"name": "share-ssr-loading",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"compile:server": "webpack --config webpack.server.config.js --progress --colors",
"serve:ssr": "node local.js",
"build:ssr": "npm run build:client-and-server-bundles && npm run compile:server",
"build:client-and-server-bundles": "ng build --prod && ng run wf-share-ssr:server:production",
"server": "node local.js",
"build:prod": "npm run build:browser:prod && npm run build:server:prod",
"serve:prerender": "node static.js",
"build:prerender": "npm run build:prod && node dist/prerender.js",
"build:prod:deploy": "npm run build:prod && npm run deploy",
"build:browser:prod": "ng build --prod",
"build:browser:serverless": "ng build --prod --base-href /",
"build:serverless": "npm run build:browser:serverless && npm run build:server:serverless",
"build:serverless:deploy": "npm run build:serverless && npm run deploy",
"deploy": "cp-cli dist/ functions/dist/ && cd functions && npm install && firebase deploy",
"build:server:prod": "ng run wf-share-ssr:server && webpack --config webpack.server.config.js --progress --colors",
"build:server:serverless": "ng run wf-share-ssr:server && webpack --config webpack.server.config.js --progress --colors",
"build:server:dev": "ng run wf-share-ssr:server && webpack --config webpack.dev.server.config.js --progress --colors",
"build:dev": "npm run build:browser:dev && npm run build:server:dev",
"build:browser:dev": "ng build",
"build:dev:run": "npm run build:dev && npm run server"
},
"private": true,
"dependencies": {
"#angular/animations": "~8.1.1",
"#angular/common": "~8.1.1",
"#angular/compiler": "~8.1.1",
"#angular/core": "~8.1.1",
"#angular/fire": "^5.2.1",
"#angular/forms": "~8.1.1",
"#angular/platform-browser": "~8.1.1",
"#angular/platform-browser-dynamic": "~8.1.1",
"#angular/platform-server": "~8.1.1",
"#angular/router": "~8.1.1",
"#ng-toolkit/serverless": "^7.1.2",
"#ng-toolkit/universal": "^7.1.2",
"#nguniversal/common": "0.0.0",
"#nguniversal/express-engine": "^7.1.0",
"#nguniversal/module-map-ngfactory-loader": "0.0.0",
"cors": "~2.8.4",
"cp-cli": "^1.1.0",
"domino": "^2.1.3",
"express": "^4.15.2",
"firebase": "^6.3.3",
"firebase-admin": "~8.0.0",
"firebase-functions": "^3.2.0",
"firebase-tools": "^7.2.1",
"preboot": "^7.0.0",
"rxjs": "~6.4.0",
"scriptjs": "^2.5.9",
"ts-loader": "^5.2.0",
"tslib": "^1.9.0",
"webpack-cli": "^3.1.0",
"xmlhttprequest": "^1.8.0",
"zone.js": "~0.9.1",
"bootstrap": "^4.3.1"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.801.1",
"#angular/cli": "~8.1.1",
"#angular/compiler-cli": "~8.1.1",
"#angular/language-service": "~8.1.1",
"#types/node": "~8.9.4",
"#types/jasmine": "~3.3.8",
"#types/jasminewd2": "~2.0.3",
"codelyzer": "^5.0.0",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"opencollective": "^1.0.3",
"protractor": "~5.4.0",
"ts-loader": "^5.2.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.4.3",
"webpack-cli": "^3.1.0"
}
}
webpack.dev.server.config.js
// Work around for https://github.com/angular/angular-cli/issues/7200
// change the regex to include the packages you want to exclude
const regex = /firebase\/(app|firestore)/;
const path = require('path');
const webpack = require('webpack');
module.exports = {
mode: 'none',
entry: {
// This is our Express server for Dynamic universal
server: './server.ts',
prerender: './prerender.ts'
},
target: 'node',
// this makes sure we include node_modules and other 3rd party libraries
externals: [/node_modules/, function(context, request, callback) {
// exclude firebase products from being bundled, so they will be loaded using require() at runtime.
if(regex.test(request)) {
return callback(null, 'commonjs ' + request);
}
callback();
}],
resolve: { extensions: ['.ts', '.js'] },
optimization: {
minimize: false
},
output: {
libraryTarget: 'commonjs2',
// Puts the output at the root of the dist folder
path: path.join(__dirname, 'dist'),
filename: '[name].js'
},
module: {
rules: [
{ test: /\.ts$/, loader: 'ts-loader' },
{
// Mark files inside `#angular/core` as using SystemJS style dynamic imports.
// Removing this will cause deprecation warnings to appear.
test: /(\\|\/)#angular(\\|\/)core(\\|\/).+\.js$/,
parser: { system: true },
},
]
},
plugins: [
new webpack.ContextReplacementPlugin(
// fixes WARNING Critical dependency: the request of a dependency is an expression
/(.+)?angular(\\|\/)core(.+)?/,
path.join(__dirname, 'src'), // location of your src
{} // a map of your routes
),
new webpack.ContextReplacementPlugin(
// fixes WARNING Critical dependency: the request of a dependency is an expression
/(.+)?express(\\|\/)(.+)?/,
path.join(__dirname, 'src'),
{}
)
]
};
Full build log:
WARNING in ./node_modules/typescript/lib/typescript.js 94814:19-45
Critical dependency: the request of a dependency is an expression
# ./prerender.ts
WARNING in ./node_modules/ws/lib/BufferUtil.js
Module not found: Error: Can't resolve 'bufferutil' in
'E:\Projects\Web\share-ssr-loading\node_modules\ws\lib'
# ./node_modules/ws/lib/BufferUtil.js
# ./node_modules/ws/lib/Receiver.js
# ./node_modules/ws/index.js
# ./server.ts
WARNING in ./node_modules/ws/lib/Validation.js
Module not found: Error: Can't resolve 'utf-8-validate' in 'E:\Projects\Web\share-ssr-loading\node_modules\ws\lib'
# ./node_modules/ws/lib/Validation.js
# ./node_modules/ws/lib/Receiver.js
# ./node_modules/ws/index.js
# ./server.ts
ERROR in E:\Projects\Web\share-ssr-loading\server.ts
./server.ts
[tsl] ERROR in E:\Projects\Web\share-ssr-loading\server.ts(39,59)
TS2339: Property 'req' does not exist on type 'object'.
ERROR in E:\Projects\Web\share-ssr-loading\server.ts
./server.ts
[tsl] ERROR in E:\Projects\Web\share-ssr-loading\server.ts(43,13)
TS2345: Argument of type 'object' is not assignable to parameter of type 'RenderOptions'.
Type '{}' is missing the following properties from type 'RenderOptions': req, bootstrap
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! share-ssr-loading#0.0.0 build:server:dev: `ng run share-ssr-loading:server && webpack --config webpack.dev.server.config.js --progress --colors`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the share-ssr-loading#0.0.0 build:server:dev 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\dev\AppData\Roaming\npm-cache\_logs\2019-08-05T21_38_27_329Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! share-ssr-loading#0.0.0 build:dev: `npm run build:browser:dev && npm run build:server:dev`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the share-ssr-loading#0.0.0 build:dev 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\dev\AppData\Roaming\npm-cache\_logs\2019-08-05T21_38_27_365Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! share-ssr-loading#0.0.0 build:dev:run: `npm run build:dev && npm run server`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the share-ssr-loading#0.0.0 build:dev:run 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\dev\AppData\Roaming\npm-cache\_logs\2019-08-05T21_38_27_393Z-debug.log
I use windows 10, node v10.16.0 npm v6.9.0
Thanks
I had the same problem a few weeks ago but never got the time to investigate it.
The workaround I used was to modify the declaration in server.ts to type options as any.
app.engine('html', (_, options: any, callback)
The solution I figured out is get hosting name(http://xxxxx.com) not http://localhost if your code is not running on your local is by using this.request.get('referer');
constructor(#Optional() #Inject(REQUEST) private request: any,
#Optional() #Inject(RESPONSE) private response: any,
#Inject(PLATFORM_ID) private platformId: Object){
if (isPlatformServer(this.platformId)) {
this.referer = 'referer: ' + this.request.get('referer');
// this.request2 = JSON.stringify(this.request);
console.log('server this.request: ' + this.request.get('host'));
} else {
this.hostName = 'document.location.hostname: ' + document.location.hostname;
console.log( 'document.location.hostname: ' + document.location.hostname); // host on the browser
}
}
In this solution, you do not need to modify server.ts. so in your server.ts.
app.engine('html', ngExpressEngine({
bootstrap: AppServerModuleNgFactory,
providers: [
provideModuleMap(LAZY_MODULE_MAP)
]
}));

Unable to find `../config/paths` and `../config/env`

I am trying to convert React.js web app to desktop app through Electron. Please find the error trace, scripts/start.js, and package.json. When I comment out require('../config/env'); it starts giving same error on const paths = require('../config/paths');
start.js
'use strict';
// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'development';
process.env.NODE_ENV = 'development';
// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => {
throw err;
});
// Ensure environment variables are read.
require('../config/env');
const fs = require('fs');
const chalk = require('chalk');
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const clearConsole = require('react-dev-utils/clearConsole');
const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
const {
choosePort,
createCompiler,
prepareProxy,
prepareUrls,
} = require('react-dev-utils/WebpackDevServerUtils');
const openBrowser = require('react-dev-utils/openBrowser');
const paths = require('../config/paths');
const config = require('../config/webpack.config.dev');
const createDevServerConfig = require('../config/webpackDevServer.config');
const useYarn = fs.existsSync(paths.yarnLockFile);
const isInteractive = process.stdout.isTTY;
// Warn and crash if required files are missing
if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
process.exit(1);
}
// Tools like Cloud9 rely on this.
const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000;
const HOST = process.env.HOST || '0.0.0.0';
if (process.env.HOST) {
console.log(
chalk.cyan(
`Attempting to bind to HOST environment variable: ${chalk.yellow(
chalk.bold(process.env.HOST)
)}`
)
);
console.log(
`If this was unintentional, check that you haven't mistakenly set it in your shell.`
);
console.log(`Learn more here: ${chalk.yellow('bitLyLink')}`);
console.log();
}
// We attempt to use the default port but if it is busy, we offer the user to
// run on a different port. `choosePort()` Promise resolves to the next free port.
choosePort(HOST, DEFAULT_PORT)
.then(port => {
if (port == null) {
// We have not found a port.
return;
}
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
const appName = require(paths.appPackageJson).name;
const urls = prepareUrls(protocol, HOST, port);
// Create a webpack compiler that is configured with custom messages.
const compiler = createCompiler(webpack, config, appName, urls, useYarn);
// Load proxy config
const proxySetting = require(paths.appPackageJson).proxy;
const proxyConfig = prepareProxy(proxySetting, paths.appPublic);
// Serve webpack assets generated by the compiler over a web sever.
const serverConfig = createDevServerConfig(
proxyConfig,
urls.lanUrlForConfig
);
const devServer = new WebpackDevServer(compiler, serverConfig);
// Launch WebpackDevServer.
devServer.listen(port, HOST, err => {
if (err) {
return console.log(err);
}
if (isInteractive) {
clearConsole();
}
console.log(chalk.cyan('Starting the development server...\n'));
openBrowser(urls.localUrlForBrowser);
});
['SIGINT', 'SIGTERM'].forEach(function(sig) {
process.on(sig, function() {
devServer.close();
process.exit();
});
});
})
.catch(err => {
if (err && err.message) {
console.log(err.message);
}
process.exit(1);
});
package.json
{
"name": "utility-core",
"version": "0.1.0",
"private": true,
"main": "public/electron.js",
"homepage": "./",
"dependencies": {
"autoprefixer": "7.1.6",
"axios": "^0.18.0",
"babel-core": "6.26.0",
"babel-eslint": "7.2.3",
"babel-jest": "20.0.3",
"babel-loader": "7.1.2",
"babel-preset-react-app": "^3.1.1",
"babel-runtime": "6.26.0",
"bootstrap": "^4.1.3",
"case-sensitive-paths-webpack-plugin": "2.1.1",
"chalk": "1.1.3",
"concurrently": "^4.1.1",
"css-loader": "0.28.7",
"dotenv": "4.0.0",
"dotenv-expand": "4.2.0",
"electron-is-dev": "^1.1.0",
"eslint": "4.10.0",
"eslint-config-react-app": "^2.1.0",
"eslint-loader": "1.9.0",
"eslint-plugin-flowtype": "2.39.1",
"eslint-plugin-import": "2.8.0",
"eslint-plugin-jsx-a11y": "5.1.1",
"eslint-plugin-react": "7.4.0",
"extract-text-webpack-plugin": "3.0.2",
"file-loader": "1.1.5",
"fs-extra": "3.0.1",
"html-webpack-plugin": "2.29.0",
"jest": "20.0.4",
"jquery": "^3.4.1",
"mdbreact": "^4.15.0",
"object-assign": "4.1.1",
"papaparse": "^4.6.0",
"postcss-flexbugs-fixes": "3.2.0",
"postcss-loader": "2.0.8",
"promise": "8.0.1",
"raf": "3.4.0",
"react": "^16.4.1",
"react-dev-utils": "^5.0.1",
"react-dom": "^16.4.1",
"react-file-reader": "^1.1.4",
"react-router-dom": "^4.2.0",
"react-spinners": "^0.4.6",
"resolve": "1.6.0",
"style-loader": "0.19.0",
"sw-precache-webpack-plugin": "0.11.4",
"universal-cookie": "^3.0.4",
"url-loader": "0.6.2",
"wait-on": "^3.2.0",
"webpack": "3.8.1",
"webpack-dev-server": "2.9.4",
"webpack-manifest-plugin": "1.3.2",
"whatwg-fetch": "2.0.3"
},
"scripts": {
"start": "node scripts/start.js",
"build": "node scripts/build.js",
"test": "node scripts/test.js --env=jsdom",
"electron-dev": "concurrently \" cross-env BROWSER=none npm run start\" \"wait-on http://localhost:3000 && electron .\"",
"electron-pack": "build -c.extraMetadata.main=build/electron.js",
"preelectron-pack": "npm run build"
},
"devDependencies": {
"cross-env": "^5.2.0",
"csv-loader": "^3.0.2",
"electron": "^1.8.8",
"electron-builder": "^20.44.4",
"electron-installer-windows": "^2.0.0",
"electron-packager": "^8.7.2"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx,mjs}"
],
"setupFiles": [
"<rootDir>/config/polyfills.js"
],
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.{js,jsx,mjs}",
"<rootDir>/src/**/?(*.)(spec|test).{js,jsx,mjs}"
],
"testEnvironment": "node",
"testURL": "http://localhost",
"transform": {
"^.+\\.(js|jsx|mjs)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"^(?!.*\\.(js|jsx|mjs|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$"
],
"moduleNameMapper": {
"^react-native$": "react-native-web"
},
"moduleFileExtensions": [
"web.js",
"js",
"json",
"web.jsx",
"jsx",
"node",
"mjs"
]
},
"babel": {
"presets": [
"env",
"react-app"
],
"plugins": []
},
"eslintConfig": {
"extends": "react-app"
},
"author": "Zain Ul Abideen",
"license": "ISC",
"build": {
"extends": null,
"appId": "com.example.utility-core",
"files": [
"build/**/*",
"node_modules/**/*",
"./public/electron.js"
],
"directories": {
"buildResources": "assets"
}
}
}
Error
D:\Import Utility\fc-import-utility\utility-core>npm run electron-dev
> utility-core#0.1.0 electron-dev D:\Import Utility\fc-import-utility\utility-core
> concurrently " cross-env BROWSER=none npm run start" "wait-on http://localhost:3000 && electron ."
[0]
[0] > utility-core#0.1.0 start D:\Import Utility\fc-import-utility\utility-core
[0] > node scripts/start.js
[0]
[0] internal/modules/cjs/loader.js:613
throw err;
[0] ^
[0]
[0] Error: Cannot find module '../config/paths'
[0] Require stack:
[0] - D:\Import Utility\fc-import-utility\utility-core\scripts\start.js
[0] at Function.Module._resolveFilename (internal/modules/cjs/loader.js:610:15)
[0] at Function.Module._load (internal/modules/cjs/loader.js:526:27)
[0] at Module.require (internal/modules/cjs/loader.js:666:19)
[0] at require (internal/modules/cjs/helpers.js:16:16)
[0] at Object.<anonymous> (D:\Import Utility\fc-import-utility\utility-core\scripts\start.js:30:15)
[0] at Module._compile (internal/modules/cjs/loader.js:759:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
[0] at Module.load (internal/modules/cjs/loader.js:628:32)
[0] at Function.Module._load (internal/modules/cjs/loader.js:555:12)
[0] at Function.Module.runMain (internal/modules/cjs/loader.js:822:10)
[0]
[0] npm ERR! Windows_NT 10.0.17134
[0] npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\HP\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "start"
[0] npm ERR! node v12.2.0
[0] npm ERR! npm v3.8.6
npm ERR! code ELIFECYCLE
[0] npm ERR! utility-core#0.1.0 start: `node scripts/start.js`
[0] npm ERR! Exit status 1
[0] npm ERR!
[0] npm ERR! Failed at the utility-core#0.1.0 start script 'node scripts/start.js'.
[0] npm ERR! Make sure you have the latest version of node.js and npm installed.
[0] npm ERR! If you do, this is most likely a problem with the utility-core package,
[0] npm ERR! not with npm itself.
[0] npm ERR! Tell the author that this fails on your system:
[0] npm ERR! node scripts/start.js
[0] npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs utility-core
[0] npm ERR! Or if that isn't available, you can get their info via:
[0] npm ERR! npm owner ls utility-core
[0] npm ERR! There is likely additional logging output above.
[0]
[0] npm ERR! Please include the following file with any support request:
[0] npm ERR! D:\Import Utility\fc-import-utility\utility-core\npm-debug.log
[0] cross-env BROWSER=none npm run start exited with code 1

Node.js and Gulp assistance

Good day, I’m new to Gulp and Node Js, I’ve been getting this error (shown below), I’ve done some research and I’ve not found any fixes.
[Browserslist] Could not parse /Users/gendyblackman/Sites/blackmanimages/package.json. Ignoring it.
assert.js:269
throw err;
AssertionError [ERR_ASSERTION]: Task never defined: clean
at getFunction (/Users/gendyblackman/Sites/blackmanimages/node_modules/undertaker/lib/helpers/normalizeArgs.js:15:5)
at map (/Users/gendyblackman/Sites/blackmanimages/node_modules/arr-map/index.js:20:14)
at normalizeArgs (/Users/gendyblackman/Sites/blackmanimages/node_modules/undertaker/lib/helpers/normalizeArgs.js:22:10)
at Gulp.series (/Users/gendyblackman/Sites/blackmanimages/node_modules/undertaker/lib/series.js:13:14)
at Object.<anonymous> (/Users/gendyblackman/Sites/blackmanimages/gulpfile.js:115:9)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
Also, when I reinstall Gulp locally I get these errors, shown below.
npm ERR! file /Users/gendyblackman/Sites/blackmanimages/package.json
npm ERR! code EJSONPARSE
npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected string in JSON at position 734 while parsing '{
npm ERR! JSON.parse "name": "blackmanimages",
npm ERR! JSON.parse "version'
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/gendyblackman/.npm/_logs/2018-07-05T14_56_20_043Z-debug.log
Any help would be great.
Thanks,
Also, here's my Gulpfile.js
// Compiles all SASS files
gulp.task('scss', function () {
return gulp.src('source/scss/**/*.scss')
.pipe(plumber())
.pipe(scss({
style: 'compressed',
}))
.pipe(rename({
basename: 'main',
suffix: '.min',
}))
.pipe(gulp.dest('build/assets/css'))
.pipe(browserSync.stream());
});
//Optimizing Images
gulp.task('images', function (){
return gulp.src('source/img/**/*.+(png|jpg|gif|svg)')
.pipe(cache(imagemin({
interlaced: true
})))
.pipe(gulp.dest('build/assets/img'))
});
// Uglify js files
gulp.task('scripts', function () {
gulp.src('source/js/*.js')
.pipe(plumber())
.pipe(uglify())
.pipe(gulp.dest('build/assets/js'))
.pipe(browserSync.stream());
});
//Concat and Compress Vendor .js files
gulp.task('vendors', function () {
gulp.src(
[
'source/js/vendors/jquery.min.js',
'source/js/vendors/*.js',
])
.pipe(plumber())
.pipe(concat('vendors.js'))
.pipe(uglify())
.pipe(gulp.dest('build/assets/js'));
});
// Watch for changes
gulp.task('watch', function () {
//Serve files from the root of this project
browserSync.init({
server: {
baseDir: "./build",
},
notify: false
});
gulp.watch(styleSrc, ['scss']);
gulp.watch(scriptSrc, ['scripts']);
gulp.watch(vendorSrc, ['vendors']);
gulp.watch(['build/*.html', 'build/assets/css/*.css', 'build/assets/js/*.js', 'build/assets/js/vendors/*.js' , '/build/assets/img/*' , '/build/assets/img/'])
.on(' change ', browserSync.reload);
});
//use default task to launch Browsersync and watch JS files
gulp.task('default',gulp.series('clean',gulp.parallel('scss', 'scripts', 'vendors',`images`,`fonts`, 'watch'), function (){
console.log('Building files');
}));
gulp.task('default', [ 'sass', 'scripts', 'vendors', 'watch'], function () );
gulp.task('default', function (callback) {runSequence(['sass','browserSync', 'watch'],callback)});
package.json
{
"name": "blackmanimages",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"browser-sync": "^2.24.5",
"del": "^3.0.0",
"express": "^4.16.3",
"gulp": "github:gulpjs/gulp#4.0",
"gulp-autoprefixer": "^5.0.0",
"gulp-cache": "^1.0.2",
"gulp-compass": "^2.1.0",
"gulp-imagemin": "^4.1.0",
"gulp-mamp": "0.0.5",
"gulp-minify-css": "^1.2.4",
"gulp-plumber": "^1.2.0",
"gulp-rename": "^1.2.3",
"gulp-sass": "^4.0.1",
"gulp-sourcemaps": "^2.6.4",
"minimatch": "^3.0.2",
"mysql": "^2.15.0",
"run-sequence": "^2.2.1"
"gulp-concat": "^2.6.1",
"gulp-contrib-copy": "0.1.3",
"gulp-cssnano": "^2.1.3",
"gulp-scss": "^1.4.0",
"gulp-uglify": "^3.0.0",
"gulp-useref": "^3.1.5"
},
"dependencies": {}
}
Error:
JSON.parse package.json must be actual JSON
your package.json is right format JSON.
Check this line :
"run-sequence": "^2.2.1"
add , to end of this line.
You didn't define task clean but you call it:
gulp.task('default',gulp.series('clean',gulp.parall .....
You should remove it or create clean.
You require('gulp-cache') but you removed it from package.json.
Check enviroment variable NODE_ENV is production ?
If true, remove it. (because you don't install devDependencies if NODE_ENV is production)

Resources