Google closure compiler build gives error Unhandled flag: outputManifest' - angularjs

Trying to implement google closure compiler to existing angularjs project. When i build application i get error java.lang.RuntimeException: Unhandled flag: outputManifest.
Here is package.json:
"devDependencies": {
"angular-mocks": "^1.7.8",
"expect.js": "^0.3.1",
"google-closure-compiler": "^20190909.0.0",
"google-closure-deps": "^20190909.0.0",
"google-closure-library": "^20190909.0.0",
"karma": "^4.3.0",
"karma-mocha": "1.3.0",
"karma-phantomjs-launcher": "1.0.4",
"less": "^3.10.3",
"mocha": "^6.2.1",
"ng-annotate": "1.2.2",
"sinon": "^7.5.0"
},
"dependencies": {
"angular": "^1.7.8",
"angular-animate": "^1.7.8",
"angular-translate": "^2.18.1",
"bootstrap": "^3.4.1",
"cesium": "^1.62.0",
"jquery": "^3.4.1",
"ol": "^6.0.1",
"olcs": "^2.9.0",
"proj4": "^2.5.0",
"url-polyfill": "^1.1.7"
}
Here is error:
{ Error: java.lang.RuntimeException: Unhandled flag: outputManifest
at mQ.QN [as Dg] (/vagrant/source/node_modules/google-closure-compiler-js/jscomp.js:8941:25462)
at mQ.TN [as Fg] (/vagrant/source/node_modules/google-closure-compiler-js/jscomp.js:8941:25657)
at mQ.ON (/vagrant/source/node_modules/google-closure-compiler-js/jscomp.js:2802:48)
at mQ.WN (/vagrant/source/node_modules/google-closure-compiler-js/jscomp.js:966:19)
at new mQ (/vagrant/source/node_modules/google-closure-compiler-js/jscomp.js:967:19)
at SHd (/vagrant/source/node_modules/google-closure-compiler-js/jscomp.js:8802:132)
at DQ (/vagrant/source/node_modules/google-closure-compiler-js/jscomp.js:2286:29)
at GQ (/vagrant/source/node_modules/google-closure-compiler-js/jscomp.js:3753:44)
at /vagrant/source/node_modules/google-closure-compiler-js/jscomp.js:3971:46
at CompilerJS.run (/vagrant/source/node_modules/google-closure-compiler/lib/node/closure-compiler-js.js:54:17)
at getFilesFromStdin.then.inputFiles (/vagrant/source/node_modules/google-closure-compiler/cli.js:164:31)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
'__java$exception':
{ g: null,
e: 'Unhandled flag: outputManifest',
backingJsObject: [Circular] } }

According to Closure Compiler's Flags and Option documentation:
--output_manifest VAL [is] Not supported by the JavaScript version
While I do not see closure-compiler-js in your package.json, I do see in your error report that you are using it to compile.
at mQ.TN [as Fg] (/vagrant/source/node_modules/google-closure-compiler-js/jscomp.js:8941:25657)
^^^^^^^^^^^^^^^^^^^^^^^^^^
So the solution to this would be either to stop using the JS version or start using flags that it supports.

Related

Can't build next.js application on production server with varying error messages with webpack

I am facing a problem with my next.js application.
In fact, I'm trying to switch my application to my production server. Before that, I tested it on my local computer, where I could build it.
Then I moved it to my pre-production server, where again I was able to build it.
However, when I run the "yarn build" command on the production server, an error is generated.
Which is :
Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
> Build error occurred
{ Error: Cannot find module 'webpack'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/var/www/vhosts/paplar-auto.fr/web/node_modules/mini-css-extract-plugin/dist/index.js:7:16)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3) code: 'MODULE_NOT_FOUND' }
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
So I tried a "yarn add webpack" and then made a new build, and I then got this error :
Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
> Build error occurred
{ Error: Cannot find module 'next-compose'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/var/www/vhosts/paplar-auto.fr/web/next.config.js:5:17)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3) code: 'MODULE_NOT_FOUND' }
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Whereas, I already have next-compose in my devDepencies (here is my package.json) :
{
"name": "web-gp",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next",
"build": "next build",
"build-static": "next build && next export",
"start": "next start -p 8000",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook",
"lint": "eslint .",
"build:svg": "svgr -d components/icons svg/"
},
"dependencies": {
"#artsy/fresnel": "^1.1.0",
"#bootstrap-styled/v4": "^3.4.0",
"#fortawesome/fontawesome-svg-core": "^1.2.28",
"#fortawesome/free-solid-svg-icons": "^5.13.0",
"#fortawesome/react-fontawesome": "^0.1.9",
"#material-ui/core": "^4.9.14",
"#material-ui/icons": "^4.9.1",
"#react-hook/window-size": "^3.0.6",
"#svgr/cli": "^5.3.1",
"#zeit/next-css": "^1.0.1",
"#zeit/next-sass": "^1.0.1",
"axios": "^0.19.2",
"babel-plugin-module-resolver": "^4.0.0",
"bootstrap": "^4.4.1",
"bootstrap-styled": "^2.7.2",
"core-js": "2.6.10",
"dotenv": "^8.2.0",
"dotenv-webpack": "^1.8.0",
"jquery": "^3.5.1",
"js-cookie": "^2.2.1",
"leaflet": "^1.6.0",
"moment": "^2.26.0",
"next": "9.3.5",
"next-fonts": "^1.0.3",
"next-images": "^1.4.0",
"nextjs-fonts": "^0.22.0",
"node-sass": "^4.14.0",
"query-string": "^6.13.1",
"react": "16.13.1",
"react-bootstrap": "^1.0.0",
"react-bootstrap-date-picker": "^5.1.0",
"react-datepicker": "^2.16.0",
"react-dom": "^16.13.1",
"react-html-parser": "^2.0.2",
"react-leaflet": "^2.7.0",
"react-leaflet-div-icon": "^1.1.0",
"react-leaflet-universal": "^2.2.1",
"react-loader-spinner": "^3.1.14",
"react-moment": "^0.9.7",
"react-papaparse": "^3.1.1",
"react-responsive": "^8.0.3",
"react-router-dom": "^5.1.2",
"react-select": "^3.1.0",
"react-slick": "^0.26.1",
"slick-carousel": "^1.8.1",
"standard-http-error": "^2.0.1",
"styled-components": "^5.1.0",
"swiper": "^6.0.2",
"webpack": "^5.50.0"
},
"devDependencies": {
"#babel/core": "^7.9.0",
"#storybook/addon-actions": "^5.3.18",
"#storybook/addon-links": "^5.3.18",
"#storybook/addons": "^5.3.18",
"#storybook/preset-typescript": "^3.0.0",
"#storybook/react": "^5.3.18",
"#storybook/theming": "^5.3.18",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.1.0",
"babel-plugin-styled-components": "^1.10.7",
"eslint": "6.6.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-react": "^7.19.0",
"fork-ts-checker-webpack-plugin": "^4.1.3",
"next-compose": "^0.0.2",
"ts-loader": "^7.0.1",
"tsconfig-paths-webpack-plugin": "^3.2.0",
"typescript": "^3.8.3"
},
"eslintConfig": {
"extends": "react-app"
}
}
I have already tried to move the packages mentioned in the errors from devDependencies to dependencies, but it does not change anything.
The errors of the missing packages vary, are not the same. Usually when I pass next-compose from devDependencies to dependencies, it tells me that typescript is missing, and when I then pass typescript from devDependencies to dependencies, it tells me again that next-compose is missing.
Anyway, I don't understand anything, does anyone have any idea what's going on?
Thanks in advance :)

swagger-codegen react client - experimental syntax 'classProperties' error

I'm trying to generate as swagger es6 client for my react application but I'm running into the following babel error:
SyntaxError: /path/to/petstore/src/ApiClient.js: Support for the experimental syntax 'classProperties' isn't currently enabled (231:33):
The steps I've taken to reach this point:
install swagger-codegen#2 using homebrew
generate swagger client using swagger-codegen generate -i http://petstore.swagger.io/v2/swagger.json -l javascript -o ./petstore --additional-properties usePromises=true,useES6=true
added toimport { PetApi } from '../../../../petstore/src';
My application'ss package.json contains the following:
"dependencies": {
"#babel/plugin-proposal-class-properties": "^7.5.5",
"ajv": "^6.10.2",
"babel": "^6.23.0",
"fuzzysort": "^1.1.4",
"immutability-helper": "^3.0.0",
"lodash": "^4.17.11",
"moment": "^2.24.0",
"moment-timezone": "^0.5.25",
"normalizr": "^3.4.0",
"prop-types-defined": "^15.6.0",
"react": "^16.8.6",
"react-redux": "^7.1.0",
"react-scripts": "3.0.1",
"redux": "^4.0.1",
"redux-mock-store": "^1.5.3",
"redux-persist": "^5.10.0",
"redux-testkit": "^1.0.6",
"redux-thunk": "^2.3.0",
"reselect": "^4.0.0",
"superagent": "^5.1.0"
},
"devDependencies": {}
My application's babel.config.js:
module.exports = {
presets: [
'module:metro-react-native-babel-preset'
],
plugins: [
[
'#babel/plugin-proposal-class-properties',
{
'loose': true
}
]
]
};
I have also tried wiping my node_modules and reinstalling them with yarn
I have tried going through all the swagger generated files and changing class properties to functions, which leads me to another error:
TypeError: _petstore_src__WEBPACK_IMPORTED_MODULE_5__.PetApi.getPetByIdWithHttpInfo is not a function
when I attempt to run PetApi.getPetByIdWithHttpInfo(1)
Let me know if any extra information is required.
Thanks

Many Internal Server Errors

Due to some package incompatibilities I have updated my package.json to the latest version for most of the entries, however now when I start the application it displays this long list of errors in the browser:
An error occurred while starting the application.
AggregateException: One or more errors occurred. (Dll Reference Plugin Invalid Options
options.manifest.content['./node_modules/fbjs/lib/invariant.js']['meta'] is an invalid additional property
options.manifest.content['./node_modules/fbjs/lib/warning.js']['meta'] is an invalid additional property
options.manifest.content['./node_modules/react-dom/lib/reactProdInvariant.js']['meta'] is an invalid additional property
options.manifest.content['./node_modules/object-assign/index.js']['meta'] is an invalid additional property
options.manifest.content['./node_modules/react-dom/lib/ReactDOMComponentTree.js']['meta'] is an invalid additional property
options.manifest.content['./node_modules/fbjs/lib/ExecutionEnvironment.js']['meta'] is an invalid additional property
options.manifest.content['./node_modules/jquery/dist/jquery.js']['meta'] is an invalid additional property
options.manifest.content['./node_modules/react/react.js']['meta'] is an invalid additional property
And it just goes on and on for about 500 errors. There were no compile errors when the project was built. Here is my package.json:
"private": true,
"version": "0.0.0",
"devDependencies": {
"#types/history": "^4.7.2",
"#types/react": "~16.0.2",
"#types/react-dom": "~16.0.9",
"#types/react-hot-loader": "~4.1.0",
"#types/react-router": "~4.4.0",
"#types/react-router-dom": "~4.3.1",
"#types/seamless-immutable": "^7.1.1",
"aspnet-webpack-react": "~4.0.0",
"awesome-typescript-loader": "3.2.1",
"bootstrap": "3.3.7",
"css-loader": "0.28.4",
"event-source-polyfill": "0.0.9",
"extract-text-webpack-plugin": "3.0.2",
"file-loader": "0.11.2",
"isomorphic-fetch": "2.2.1",
"jquery": "3.2.1",
"json-loader": "0.5.4",
"react-hot-loader": "~4.3.12",
"react-router-dom": "~4.3.1",
"style-loader": "0.18.2",
"typescript": "~3.1.6",
"url-loader": "0.5.9",
"webpack": "4.25.1",
"webpack-hot-middleware": "2.18.2",
"#types/webpack-env": "1.13.0",
"aspnet-webpack": "3.0.0",
"webpack-dev-middleware": "3.4.0",
"#types/deep-freeze": "^0.1.1",
"#types/deep-freeze-es6": "^1.0.0",
"#types/material-ui": "^0.20.4",
"#types/react-datepicker": "~1.1.7",
"#types/react-virtualized": "~9.18.7",
"a-react-timepicker": "~2.0.0"
},
"dependencies": {
"deep-freeze-es6": "https://registry.npmjs.org/deep-freeze-es6/-/deep-freeze-es6-1.0.1.tgz",
"history": "https://registry.npmjs.org/history/-/history-4.6.3.tgz",
"react-datepicker": "~1.8.0",
"react-timekeeper": "~1.0.9",
"react-virtualized": "~9.21.0",
"seamless-immutable": "^7.1.2",
"react": "~16.6.0",
"react-dom": "~16.6.0",
"moment": "2.20.0"
}
Is anyone familiar with why this is happening? I've searched multiple posts and it seems like people always just have a couple errors. Not 500.
I don't know if you solved it or not , but I had the same problem when I updated to Webpack 4 . The solution was to to run the DllPlugin from webpack.config.vendor.js so that vendor-manifest.json would get the latest attributes.
To do this, in packages.json put this line in the scripts section
"scripts": {
"build": "webpack --config webpack.config.vendor.js",
}
and from console run npm run build

Asp.Net Core with react and material-ui

I create an Asp.Net Core project with the react template. I then proceed to install material-ui with the help of this page. I got some dependency issues, so I had to update the react and react-dom package followed up with updating some related packages and ending up with this package.json configuration:
{
"name": "MaterialUITest",
"private": true,
"version": "0.0.0",
"devDependencies": {
"#types/history": "4.6.0",
"#types/react": "15.0.35",
"#types/react-dom": "15.5.1",
"#types/react-hot-loader": "3.0.3",
"#types/react-router": "4.0.12",
"#types/react-router-dom": "4.0.5",
"#types/webpack-env": "1.13.0",
"aspnet-webpack": "^2.0.1",
"aspnet-webpack-react": "^3.0.0",
"awesome-typescript-loader": "3.2.1",
"bootstrap": "3.3.7",
"css-loader": "0.28.4",
"event-source-polyfill": "0.0.9",
"extract-text-webpack-plugin": "2.1.2",
"file-loader": "0.11.2",
"isomorphic-fetch": "2.2.1",
"jquery": "3.2.1",
"json-loader": "0.5.4",
"react": "16.4.1",
"react-dom": "16.4.1",
"react-hot-loader": "3.0.0-beta.7",
"react-router-dom": "4.3.1",
"style-loader": "0.18.2",
"typescript": "2.4.1",
"url-loader": "0.5.9",
"webpack": "2.5.1",
"webpack-hot-middleware": "2.18.2"
},
"dependencies": {
"#material-ui/core": "^1.2.3",
"#material-ui/icons": "^1.1.0"
}
}
Now if I go ahead and add this to the beginning of Counter.tsx:
import Paper from '#material-ui/core/Paper'
Everything seems fine, I get no errors nor do I get notified that something went wrong. So I proceed to start the program and the next thing I get is the debugging error view telling me it is expecting some signs:
ERROR in [at-loader] ./node_modules/#material-ui/core/index.d.ts:57:34
TS1005: ')' expected.
ERROR in [at-loader] ./node_modules/#material-ui/core/index.d.ts:57:63
TS1005: '(' expected.
ERROR in [at-loader] ./node_modules/#material-ui/core/index.d.ts:57:67
TS1005: ',' expected.
ERROR in [at-loader] ./node_modules/#material-ui/core/index.d.ts:57:85
TS1005: '(' expected.
... and so on
I tried to update the pre-installed packages, but that just gave me more dependency issues which I could not resolve.
If anyone could try and create a Project that runs smoothly with Asp.Net Core, react and material-ui, I'd be thankful if you'd let me know how.
Fixed with the new Project Template, update to .Net Core 2.1 and Visual Studio 15.7

Can't run Karma with Angular 1.4.9 with error angular.module(...).info is not a function

When running karma start --single-run
there is an error
Chrome 62.0.3202 (Linux 0.0.0) ERROR
Uncaught TypeError: angular.module(...).info is not a function
at /home/ali/bedopedia/client/node_modules/angular-mocks/angular-mocks.js:80
When I opened anguler-mocks.js there is a function called info and it need angular 1.6 .info({ angularVersion: '1.6.6' })
here is package.json file
"devDependencies": {
"angular-mocks": "^1.6.0",
"grunt": "^0.4.5",
"grunt-jsmeter": "^0.3.1",
"jasmine-core": "^2.5.2",
"karma": "^0.13.22",
"karma-chrome-launcher": "^0.2.3",
"karma-jasmine": "^0.3.8",
"karma-spec-reporter": "0.0.26",
"load-grunt-tasks": "^3.5.0"
}
I solved it by making angular-mocks version the same version of angular I am using.
make it "angular-mocks": "1.4.9", in package.json file

Resources