How can I fix the error below:
> ng "serve" "0.0.0.0" "--poll=2500" "--disable-host-check" "--prod=true"
WARNING Running a server with --disable-host-check is a security risk. See https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a for more information.
****************************************************************************************
This is a simple server for use in testing or debugging Angular applications locally.
It hasn't been reviewed for security issues.
DON'T USE IT FOR PRODUCTION!
****************************************************************************************
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
95% emittingUnhandled rejection Error: ENOENT: no such file or directory, open '/usr/src/web/node_modules/handsontable/package.json'
at Object.openSync (fs.js:461:3)
at Object.readFileSync (fs.js:364:35)
at LicenseExtractor.readPackageJson (/usr/src/web/node_modules/license-webpack-plugin/dist/LicenseExtractor.js:126:23)
at LicenseExtractor.parsePackage (/usr/src/web/node_modules/license-webpack-plugin/dist/LicenseExtractor.js:23:32)
at ModuleProcessor.processPackage (/usr/src/web/node_modules/license-webpack-plugin/dist/ModuleProcessor.js:44:46)
at ModuleProcessor.processFile (/usr/src/web/node_modules/license-webpack-plugin/dist/ModuleProcessor.js:41:21)
at fileCallback (/usr/src/web/node_modules/license-webpack-plugin/dist/LicenseWebpackPlugin.js:107:61)
at moduleCallback (/usr/src/web/node_modules/license-webpack-plugin/dist/LicenseWebpackPlugin.js:114:21)
at /usr/src/web/node_modules/license-webpack-plugin/dist/LicenseWebpackPlugin.js:126:29
at Array.forEach (<anonymous>)
at Compiler.emitCallback (/usr/src/web/node_modules/license-webpack-plugin/dist/LicenseWebpackPlugin.js:92:32)
at next (/usr/src/web/node_modules/tapable/lib/Tapable.js:204:14)
at /usr/src/web/node_modules/html-webpack-plugin/index.js:204:9
at PassThroughHandlerContext.finallyHandler (/usr/src/web/node_modules/bluebird/js/release/finally.js:56:23)
at PassThroughHandlerContext.tryCatcher (/usr/src/web/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/usr/src/web/node_modules/bluebird/js/release/promise.js:547:31)
thrown when:
npm run ng serve --host 0.0.0.0 -- --poll=2500 --disable-host-check --prod=true
is run. But which isn't thrown when:
npm run ng serve --host 0.0.0.0 -- --poll=2500 --disable-host-check
is run?
Here's the package.json:
{
"name": "retailportal-web",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"ng": "ng",
"start": "ng serve --host 0.0.0.0",
"test": "ng test",
"build": "ng build --base-href /SopPortal/",
"build-prod": "ng build --prod --base-href /SopPortal/",
"pree2e": "webdriver-manager update --standalone false --gecko false",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular/animations": "5.1.1",
"@angular/cdk": "5.0.1",
"@angular/common": "~5.1.1",
"@angular/compiler": "~5.1.1",
"@angular/core": "~5.1.1",
"@angular/forms": "~5.1.1",
"@angular/http": "~5.1.1",
"@angular/material": "5.0.1",
"@angular/material-moment-adapter": "5.0.3",
"@angular/platform-browser": "~5.1.1",
"@angular/platform-browser-dynamic": "~5.1.1",
"@angular/router": "~5.1.1",
"@ng-bootstrap/ng-bootstrap": "~1.0.0-beta.8",
"@ng-select/ng-select": "~0.25.0",
"@ngx-translate/core": "~9.0.2",
"@ngx-translate/http-loader": "~2.0.0",
"@types/jquery": "~3.2.17",
"angular-highcharts": "5.2.8",
"compass-sass-mixins": "0.12.7",
"core-js": "~2.5.3",
"enhanced-resolve": "3.3.0",
"font-awesome": "4.7.0",
"hammerjs": "~2.0.8",
"highcharts": "6.0.6",
"numbro": "2.1.2",
"jquery": "~3.2.1",
"ng-bootstrap": "~1.6.3",
"ng2-file-upload": "~1.3.0",
"ng2-handsontable": "2.0.0",
"node-sass": "^4.7.2",
"rxjs": "~5.5.5",
"tether": "~1.4.3",
"ts-helpers": "~1.1.2",
"zone.js": "~0.8.18"
},
"devDependencies": {
"@angular/cli": "1.7.1",
"@angular/compiler-cli": "~5.0.0",
"@types/highcharts": "5.0.16",
"@types/jasmine": "2.5.45",
"@types/jquery": "~3.2.12",
"@types/node": "~6.0.60",
"codelyzer": "~3.1.1",
"jasmine-core": "2.6.2",
"jasmine-spec-reporter": "4.1.0",
"karma": "1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-jasmine": "~1.1.0",
"karma-remap-istanbul": "~0.2.1",
"moment": "~2.20.1",
"protractor": "~5.1.2",
"ts-md5": "~1.2.0",
"ts-node": "3.0.4",
"tslint": "~5.3.2",
"typescript": "2.4.2"
}
}
and npm ls --depth=0
:
# npm ls --depth=0
[email protected] /usr/src/web
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- UNMET PEER DEPENDENCY @angular/[email protected]
+-- UNMET PEER DEPENDENCY @angular/[email protected]
+-- @angular/[email protected]
+-- UNMET PEER DEPENDENCY @angular/[email protected]
+-- UNMET PEER DEPENDENCY @angular/[email protected]
+-- @angular/[email protected]
+-- UNMET PEER DEPENDENCY @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @ng-bootstrap/[email protected]
+-- @ng-select/[email protected]
+-- @ngx-translate/[email protected]
+-- @ngx-translate/[email protected]
+-- @types/[email protected]
+-- @types/[email protected]
+-- @types/[email protected]
+-- @types/[email protected]
+-- [email protected]
+-- [email protected] extraneous
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- extraneous error: ENOENT: no such file or directory, open '/usr/src/web/node_modules/handsontable/package.json
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
`-- [email protected]
npm ERR! peer dep missing: @angular/common@^4.0.0, required by [email protected]
npm ERR! peer dep missing: @angular/[email protected], required by @angular/[email protected]
npm ERR! peer dep missing: @angular/compiler@^2.3.1 || >=4.0.0-beta <5.0.0, required by [email protected]
npm ERR! peer dep missing: @angular/compiler@^4.0.0, required by [email protected]
npm ERR! peer dep missing: @angular/[email protected], required by @angular/[email protected]
npm ERR! peer dep missing: @angular/core@^2.3.1 || >=4.0.0-beta <5.0.0, required by [email protected]
npm ERR! peer dep missing: @angular/core@^4.0.0, required by [email protected]
npm ERR! peer dep missing: @angular/forms@^4.0.0, required by [email protected]
npm ERR! peer dep missing: @angular/[email protected], required by @angular/[email protected]
npm ERR! extraneous: handsontable /usr/src/web/node_modules/handsontable
npm ERR! error in /usr/src/web/node_modules/handsontable: ENOENT: no such file or directory, open '/usr/src/web/node_modules/handsontable/package.json'
npm ERR! extraneous: [email protected] /usr/src/web/node_modules/bindings
node & npm versions:
# node --version
v14.2.0
# npm --version
6.14.4
#
also tried with node 6 to no avail.
the package handsontable
is supplied independent from npm.
When you build in prod mode, angular tries to extract licenses from the 3rd party libs that you use into a 3rdpartylicenses.txt
file. For that, it needs looking at package.json
files.
Since you put your handontable
package manually in your node_modules
, it's missing package.json
.
What you should really do is install handontable
with npm (specify the version if needed)
npm add -S handsontable
A workaround is to disable extracting the licenses, by passing a flag when building
npm run ng serve --host 0.0.0.0 --poll=2500 --disable-host-check --prod=true --extractLicenses=false