npm production build issue (npm version build -Pprod) - node.js

Versions
c:\dev\sam>npm -v
5.5.1
c:\dev\sam>node -v
v8.9.2
c:\dev\sam>
Issue
c:\dev\sam> mvnw -Pprod -DskipTests package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SAM 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
...
[INFO] --- frontend-maven-plugin:1.4:install-node-and-npm (install node and npm) # sam ---
[INFO] Node v6.11.0 is already installed.
[INFO] NPM 5.0.3 is already installed.
...
INFO] ERROR in ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js!./src/main/webapp/content/scss/global.scss
[INFO] Module build failed: Error: Missing binding c:\dev\sam\node_modules\node-sass\vendor\win32-x64-48\binding.node
[INFO] Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 6.x
[INFO]
[INFO] Found bindings for the following environments:
[INFO] - Windows 64-bit with Node.js 8.x
[INFO]
[INFO] This usually happens because your environment has changed since running `npm install`.
[INFO] Run `npm rebuild node-sass` to download the binding for your current environment.
...
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20.684 s
[INFO] Finished at: 2018-07-12T06:56:14+01:00
[INFO] Final Memory: 35M/501M
[INFO] ------------------------------------------------------------------------
package.json
c:\dev\sam>more package.json
{
"name": "sam",
"version": "0.0.0",
"description": "Description for SAM",
"private": true,
"cacheDirectories": [
"node_modules"
],
"dependencies": {
"#angular/animations": "5.2.10",
"#angular/cdk": "5.2.5",
"#angular/common": "5.2.0",
"#angular/compiler": "5.2.0",
"#angular/core": "5.2.0",
"#angular/forms": "5.2.0",
"#angular/http": "5.2.0",
"#angular/material": "5.2.5",
"#angular/platform-browser": "5.2.0",
"#angular/platform-browser-dynamic": "5.2.0",
"#angular/router": "5.2.0",
"#ng-bootstrap/ng-bootstrap": "1.0.0",
"angular-calendar": "^0.25.1",
"angular-highcharts": "6.0.0",
"bootstrap": "4.0.0",
"core-js": "2.4.1",
"font-awesome": "4.7.0",
"highcharts": "6.1.0",
"jquery": "3.2.1",
"lodash": "4.17.5",
"ng-jhipster": "0.4.0",
"ng2-nouislider": "1.7.7",
"ng2-pdf-viewer": "4.1.2",
"ngx-cookie": "2.0.1",
"ngx-infinite-scroll": "0.5.1",
"ngx-stripe": "0.8.2",
"ngx-webstorage": "2.0.1",
"nouislider": "11.1.0",
"reflect-metadata": "0.1.10",
"rxjs": "5.5.6",
"sockjs-client": "1.1.4",
"swagger-ui": "2.2.10",
"tether": "1.4.0",
"webstomp-client": "1.0.6",
"zone.js": "0.8.19",
"popper.js": "^1.12.9"
},
"devDependencies": {
"#angular/cli": "1.6.6",
"#angular/compiler-cli": "5.2.0",
"#ngtools/webpack": "1.8.5",
"#types/highcharts": "5.0.22",
"#types/jasmine": "2.5.53",
"#types/lodash": "4.14.107",
"#types/node": "8.0.18",
"angular2-template-loader": "0.6.2",
"awesome-typescript-loader": "3.2.2",
"browser-sync": "2.18.13",
"browser-sync-webpack-plugin": "1.2.0",
"codelyzer": "4.0.1",
"copy-webpack-plugin": "4.2.3",
"css-loader": "0.28.4",
"exports-loader": "0.6.4",
"extract-text-webpack-plugin": "3.0.2",
"file-loader": "1.1.5",
"generator-jhipster": "4.14.3",
"html-loader": "0.5.0",
"html-webpack-plugin": "2.30.1",
"jasmine-core": "2.7.0",
"karma": "1.7.1",
"karma-chrome-launcher": "2.2.0",
"karma-coverage": "1.1.1",
"karma-intl-shim": "1.0.3",
"karma-jasmine": "1.1.0",
"karma-junit-reporter": "1.2.0",
"karma-notify-reporter": "1.0.1",
"karma-phantomjs-launcher": "1.0.4",
"karma-remap-istanbul": "0.6.0",
"karma-sourcemap-loader": "0.3.7",
"karma-webpack": "2.0.4",
"node-sass": "^4.9.2",
"phantomjs-prebuilt": "2.1.16",
"postcss-loader": "2.0.9",
"proxy-middleware": "0.15.0",
"rimraf": "2.6.1",
"sass-loader": "6.0.6",
"source-map": "0.6.1",
"sourcemap-istanbul-instrumenter-loader": "0.2.0",
"style-loader": "0.18.2",
"to-string-loader": "1.1.5",
"tslint": "5.5.0",
"tslint-loader": "3.5.3",
"typescript": "2.6.2",
"uglifyjs-webpack-plugin": "1.1.5",
"web-app-manifest-loader": "0.1.1",
"webpack": "3.10.0",
"webpack-dev-server": "2.9.5",
"webpack-merge": "4.1.1",
"webpack-notifier": "1.5.1",
"webpack-visualizer-plugin": "0.1.11",
"workbox-webpack-plugin": "3.0.0-beta.1",
"write-file-webpack-plugin": "4.1.0",
"xml2js": "0.4.17"
},
"engines": {
"node": ">=6.9.0"
},
"resolutions": {
"source-map": "0.6.1"
},
"scripts": {
"lint": "tslint --project tsconfig.json -e 'node_modules/**'",
"lint:fix": "npm run lint -- --fix",
"ngc": "ngc -p tsconfig-aot.json",
"cleanup": "rimraf target/{aot,www}",
"clean-www": "rimraf target//www/app/{src,target/}",
"start": "npm run webpack:dev",
"serve": "npm run start",
"build": "npm run webpack:prod",
"test": "npm run lint && karma start src/test/javascript/karma.conf.js",
"test:watch": "npm test -- --watch",
"webpack:dev": "npm run webpack-dev-server -- --config webpack/webpack.dev.js --progress --inline --hot --profile --port=9060 --watch-content-base",
"webpack:build:main": "npm run webpack -- --config webpack/webpack.dev.js --progress --profile",
"webpack:build": "npm run cleanup && npm run webpack:build:main",
"webpack:prod:main": "npm run webpack -- --config webpack/webpack.prod.js --profile",
"webpack:prod": "npm run cleanup && npm run webpack:prod:main && npm run clean-www",
"webpack:test": "npm run test",
"webpack-dev-server": "node --max_old_space_size=4096 node_modules/webpack-dev-server/bin/webpack-dev-server.js",
"webpack": "node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js",
"postinstall": "node node_modules/phantomjs-prebuilt/install.js"
}
}
Question
I'm not sure why this is failing.
The dev build is working perfectly.
The prod build fails (it never worked).
For some reason npm is looking for a different version of nodejs (6) rather than the version I have installed (8), perhaps ?
I do have a binding file but not the one that the build is looking for.
I have cleaned down my node_modules and installed again but that hasn't solved the issue.
I have tried the npm rebuild node-sass but perhaps this is downloading the version that is there (8) rather than (6) ?
Should I "downgrade" to 6 ?
Or how do I upgrade the build ?
Any advise on how to resolve this and what the reason for the above is ?
And what the correct configuration should be ?
Note: this is a jhipster generated project (if that makes any difference).
Thanks a million for taking the time to explain this.
Kind regards,
Fergal.

Prod build does not use the version of node you installed on your PC, it installs one locally under node sub folder as specified in the pom.xml. So you could try to edit your pom.xml and use same version of node and npm as your PC.

Related

Strategy to update Node.js and npm

We are currently using, npm - 9.1.3 and node - v16.14.2
What's a good strategy to update both the npm and node to the latest versions in the Windows environment?
Are there any issues involved?
My package.json looks like,
{
"name": "myreact",
"version": "1.0.0",
"description": "",
"scripts": {
"test": "jest --verbose --colors",
"test:ci": "jest --ci --watchAll=false --colors --reporters=default --reporters=jest-junit --coverage --coverageReporters=cobertura --coverageThreshold '{}'",
"test:coverage": "jest --verbose --coverage",
"test:watch": "jest --verbose --watch",
"test-debug": "node --inspect-brk --inspect ./node_modules/jest/bin/jest -i",
"start": "concurrently \"webpack-dev-server --mode development --open\" \"npm:stubby\"",
"start:iis": "webpack-dev-server --mode development --open --iis",
"build": "webpack --progress --mode production",
"build:dev": "webpack --progress --mode production --dev",
"build:prod": "lingui add-locale en && lingui extract --clean && lingui compile && webpack --mode production",
"lint": "eslint --cache --format codeframe --ext mjs,jsx,js src",
"add-locale": "lingui add-locale",
"extract": "lingui extract",
"compile": "lingui compile",
"stubby": "stubby --data stubs/stubby.yaml --watch"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"#craftjs/core": "0.2.0-beta.1",
"#craftjs/utils": "0.2.0-beta.1",
"#my/react-homegrown": "file:..//thirdparty/react/#my/my-react-homegrown-0.10.90.tgz",
"#lingui/core": "^2.9.1",
"#lingui/macro": "^2.9.1",
"#lingui/react": "^2.9.1",
"#material-ui/core": "^4.11.0",
"#material-ui/lab": "^4.0.0-alpha.56",
"#tinymce/tinymce-react": "^3.12.8",
"antlr4": "4.8.0",
"axios": "^0.26",
"classnames": "^2.3.1",
"date-fns": "^2.14.0",
"file-saver": "^2.0.5",
"formik": "^2.1.4",
"immer": "^9.0.12",
"json5": "^2.2.3",
"lodash": "^4.17.21",
"moment": "^2.29.4",
"nanoid": "^3.1.32",
"prop-types": "^15.7.2",
"pubsub-js": "^1.9.2",
"qs": "^6.11.0",
"react": "^16.14.0",
"react-container-query": "^0.12.0",
"react-datepicker": "^2.16.0",
"react-dom": "^16.14.0",
"react-resize-detector": "^6.7.2",
"react-resize-panel": "^0.3.5",
"react-router-dom": "^5.2.0",
"react-to-print": "^2.14.7",
"react-virtualized-auto-sizer": "^1.0.5",
"react-window": "^1.8.6",
"recoil": "^0.7.0",
"resolve": "^1.22.1",
"sanitize-html": "2.7.1",
"sheetjs-style": "^0.15.8",
"tinymce": "^5.10.7",
"yup": "^0.32.11"
},
"peerDependencies": {
"react": "^16.14.0",
"react-dom": "^16.14.0"
},
"devDependencies": {
"#babel/core": "^7.10.4",
"#babel/preset-react": "^7.14.5",
"#lingui/cli": "^2.9.2",
"#neutrinojs/airbnb": "^9.2.0",
"#neutrinojs/compile-loader": "^9.2.0",
"#neutrinojs/dev-server": "^9.4.0",
"#neutrinojs/eslint": "^9.2.0",
"#neutrinojs/jest": "^9.2.0",
"#neutrinojs/react": "^9.2.0",
"#tippyjs/react": "^4.0.5",
"#types/jest": "^25.2.3",
"assets-webpack-plugin": "^5.1.2",
"autoprefixer": "^9.8.4",
"babel-core": "^7.0.0-bridge.0",
"babel-plugin-macros": "^2.8.0",
"concurrently": "^5.3.0",
"core-js": "^2.6.11",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6",
"enzyme-to-json": "^3.5.0",
"eslint": "^6.8.0",
"eslint-plugin-react-hooks": "^4.0.6",
"identity-obj-proxy": "^3.0.0",
"jest": "^26.6.3",
"jest-junit": "12.1.0",
"moment-locales-webpack-plugin": "^1.2.0",
"neutrino": "^9.2.0",
"postcss-loader": "^3.0.0",
"rc-slider": "^8.7.1",
"react-overlays": "^1.2.0",
"react-scripts": "^4.0.3",
"sass": "^1.49.9",
"sass-loader": "^10.0.5",
"stubby": "^5.0.0",
"style-loader": "^1.2.1",
"styled-components": "^4.1.2",
"webpack": "^4.44.2",
"webpack-bundle-analyzer": "^4.3.0",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.1"
}
}
Upgrading dependencies always comes with the risk of causing breakage to older dependencies. Typically, that occurs when you're using a really old module that requires one of your other modules to be on an older version as you go to upgrade it.
One really neat way to find outdated packages comes built-into NPM. Try running this in your both your backend and frontend projects:
npm outdated
It will return a list that's likely very large of outdated packages. Go through each package and try to find the ones with the largest disparity between the Current and Latest version. These packages will be the most difficult to upgrade. Also the packages that have a very small difference between current and latest means they are likely outdated. You'll want to check their Github repository to see when the last commit was and generally if it's being maintained anymore.
Upgrading past Node 16 is likely to cause breaking changes in your app on the backend. In terms of your front-end and the compiled client, it's not going to have much effect. Upgrading from React 16 to 18 has many breaking changes though. Migrating from Material-UI v4 to v5 has many breaking changes. Also moving from react-scripts 4 to 5 has quite a few changes.
In general, you'll want to go through all your packages and do some research based on the business needs. It's common for businesses to have to make the touch choice between keeping an older module pegged for awhile before upgrading it, as it may cause a required refactor.

Error: Failed to transpile TypeScript Error: Failed to transpile TypeScript

I have an application that uses ionic and angular. For deploying the same application as a mobile app, I tried ionic cordova build android, which gave me an error. bash: ionic: command not found
So, without realizing what disaster it could cause I installed it using the command.
npm install -g #ionic/cli.
Then I again run the command ionic cordova build android.
But due to the version of node being 8.12.0 installed in my machine, it gave me an error and I couldn't run that command.
and I reinstall the node, and tried again.
And now coming back to the application, I tried to build that to production, since then it is always giving me an error saying
Cannot find type definition file for '#types'.
I removed the ionic CLI, uninstall node js, and uninstall npm. Uninstall everything related to node. But the problem has not been gone yet.
I also deleted node_modules and package-lock json and npm cache clean --force, npm install.
But it did not work.
As the error says Cannot find type definition file for '#types', I also added the types in tsconfig.json,
"types": [],
into
"compilerOptions"
Though the error goes away while npm run build --prod --verbose, but the application doesn't run further, it gave a lot of error in the console and the application just stopped.
package.json
{
"name": "ClientApp",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "node --max-old-space-size=8192 ./node_modules/#ionic/app-scripts/bin/ionic-app-scripts.js build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"#angular/animations": "5.2.9",
"#angular/common": "5.2.9",
"#angular/compiler": "5.2.9",
"#angular/compiler-cli": "5.2.9",
"#angular/core": "5.2.9",
"#angular/forms": "5.2.9",
"#angular/http": "5.2.9",
"#angular/platform-browser": "5.2.9",
"#angular/platform-browser-dynamic": "5.2.9",
"#ionic-native/core": "4.6.0",
"#ionic-native/splash-screen": "4.6.0",
"#ionic-native/status-bar": "4.6.0",
"#ionic/pro": "1.0.20",
"#ionic/storage": "2.1.3",
"alertify.js": "^1.0.12",
"angular-tree-component": "^7.1.0",
"angular2-cookie": "^1.2.6",
"angular2-indexeddb": "^1.2.2",
"blueimp-canvas-to-blob": "^3.20.0",
"bootstrap": "^4.1.0",
"chart.js": "^2.9.3",
"cordova-android": "7.0.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-ionic-keyboard": "^2.0.5",
"cordova-plugin-ionic-webview": "^1.2.1",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-whitelist": "^1.3.3",
"dragula": "^3.7.2",
"idlejs": "^2.1.0",
"ionic-angular": "3.9.2",
"ionic3-star-rating": "^2.1.2",
"ionicons": "3.0.0",
"jquery": "^3.3.1",
"microsoft-applicationinsights-angular5": "^0.1.6",
"ng2-ckeditor": "^1.2.0",
"ng2-dragula": "^2.1.1",
"ng2-google-charts": "^6.0.0",
"ng2-img-max": "^2.2.4",
"ng2-order-pipe": "^0.1.5",
"ng2-pagination": "^2.0.2",
"ng4-validators": "^6.0.0",
"ngx-autosize": "^1.8.0",
"ngx-color-picker": "^7.0.2",
"ngx-order-pipe": "^2.0.4",
"ngx-pinch-zoom": "^2.4.4",
"ngx-skeleton-loader": "^1.2.7",
"node-sass": "^4.14.1",
"popper.js": "^1.14.3",
"rxjs": "5.5.8",
"sw-toolbox": "3.6.0",
"xlsx": "^0.17.0",
"zone.js": "0.8.20"
},
"devDependencies": {
"#ionic/app-scripts": "^3.2.4",
"typescript": "~2.6.2"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-ionic-keyboard": {}
},
"platforms": [
"android"
]
},
"config": {
"ionic_www_dir": "../",
"ionic_build_dir": "../build"
}
}
what should I do to build this application, which was built before but now had stopped?

Run Out of Memory Using Node Build 'ng build' - Angular App

I am trying to build my angular application using 'ng build'. It is failing because it is running out of memory to build as I surmise from my research. I have tried several of the solutions out there with no luck. After typing 'ng build' either from VSC terminal or on DOS line, it runs for about 3 minutes during this step:
Generating ES5 bundles for differential loading...
then it fails with this error written to my angular-errors.log file:
[error] Error: Call retries were exceeded
at ChildProcessWorker.initialize (c:\development\gems\Frontend_Serenity_A9_SLIM\Frontend_Serenity_A9\node_modules\jest-worker\build\workers\ChildProcessWorker.js:193:21)
at ChildProcessWorker.onExit (c:\development\gems\Frontend_Serenity_A9_SLIM\Frontend_Serenity_A9\node_modules\jest-worker\build\workers\ChildProcessWorker.js:263:12)
at ChildProcess.emit (events.js:203:13)
at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
I have tried increasing my memory as some articles/stack overflows have indicated. I tried this:
npm install -g increase-memory-limit
and then ran this command at the root of my angular project:
increase-memory-limit
to no avail. Using es5 rather than es2015 is not a solution for our app. Any help or ideas you can offer are GREATLY appreciated. I have been trying everything for a week now and am still stuck. Thanks!
package.json contents:
{
"name": "serenity",
"version": "9.0.0",
"license": "PrimeNG Commercial",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "9.0.4",
"#angular/cdk": "9.1.0",
"#angular/common": "9.0.4",
"#angular/compiler": "9.0.4",
"#angular/core": "9.0.4",
"#angular/forms": "9.0.4",
"#angular/material": "^9.1.0",
"#angular/platform-browser": "9.0.4",
"#angular/platform-browser-dynamic": "9.0.4",
"#angular/router": "9.0.4",
"#aspnet/signalr": "^1.1.4",
"#fullcalendar/core": "4.0.2",
"#fullcalendar/daygrid": "4.0.1",
"#fullcalendar/interaction": "4.0.2",
"#fullcalendar/timegrid": "4.0.1",
"#handsontable/angular": "^5.1.1",
"#mdi/svg": "^5.3.45",
"#types/leaflet-draw": "^1.0.2",
"#types/plotly.js": "^1.50.12",
"chart.js": "2.7.3",
"d3": "^5.16.0",
"font-awesome": "4.7.0",
"handsontable": "^7.4.2",
"intl": "1.2.5",
"leaflet": "^1.6.0",
"leaflet-draw": "^1.0.4",
"leaflet-sidebar-v2": "^3.2.2",
"leaflet.control.layers.tree": "^1.0.0",
"leaflet.glify": "^3.0.0",
"material-design-icons": "^3.0.1",
"plotly.js-dist": "^1.54.1",
"primeflex": "1.0.0",
"primeng": "9.0.1",
"prismjs": "1.15.0",
"quill": "1.1.8",
"rxjs": "6.5.4",
"three": "^0.117.1",
"web-animations-js": "github:angular/web-animations-js#release_pr208",
"xlsx": "^0.16.2",
"zone.js": "0.10.2"
},
"devDependencies": {
"#angular-devkit/build-angular": "0.900.4",
"#angular/cli": "9.0.4",
"#angular/compiler-cli": "9.0.4",
"#angular/language-service": "9.0.4",
"#types/jasmine": "3.5.7",
"#types/jasminewd2": "2.0.8",
"#types/leaflet": "^1.5.17",
"#types/node": "12.12.29",
"codelyzer": "5.2.1",
"jasmine-core": "3.5.0",
"jasmine-spec-reporter": "4.2.1",
"karma": "4.3.0",
"karma-chrome-launcher": "3.1.0",
"karma-coverage-istanbul-reporter": "2.1.1",
"karma-jasmine": "2.0.1",
"karma-jasmine-html-reporter": "1.5.2",
"protractor": "5.4.3",
"ts-node": "8.3.0",
"tslint": "5.18.0",
"typescript": "3.7.5"
}
}
Note sure if this will help in your case, but have you tried increasing the maximumError in the budgets section under configurations in the angular.json file?
Yes, it was a memory issue and I was having a hard time getting node to change the memory limit before it built my project. I was able to get it to allocate 3 gigs and then it worked fine.

NPM install results in 404 when installing angular deps

I have the latest node.js 8.x and npm 5.6.0 installed. When trying to do a npm install, I constantly get the following error:
npm ERR! code E404
npm ERR! 404 Not Found: #angular/router#5.2.0
The module that fails is different every time I retry the installation, but most typically it's #angular/forms#5.2.0, #angular/animations#5.2.0 and #angular/platform-browser#5.2.0
I do have a working internet connection
I have run npm config set registry https://registry.npmjs.org/.
I deleted the node_modules folder
I have deleted the cache: npm cache clean --force
An npm search does find the module:
C:\windows\system32>npm search #angular/router
NAME | DESCRIPTION | AUTHOR | DATE | VERSION | KEYWORDS
#angular/router | Angular -
theā€¦ | =angular | 2018-04-16 | 5.2.10 | angular router
What else can be wrong?
Here is the package.json for completeness:
{
"name": "App",
"angular-cli": {},
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --env=scapp",
"build-local": "ng build --env=dev",
"build-nonevis": "ng build --env=nonevis",
"test": "ng test",
"lint": "ng lint",
"lint-fix": "ng lint --fix",
"e2e": "ng e2e"
},
"dependencies": {
"#angular/animations": "5.2.0",
"#angular/common": "^5.2.0",
"#angular/compiler": "^5.2.0",
"#angular/core": "^5.2.0",
"#angular/forms": "5.2.0",
"#angular/http": "5.2.0",
"#angular/platform-browser": "5.2.0",
"#angular/platform-browser-dynamic": "5.2.0",
"#angular/router": "5.2.0",
"#ngx-translate/core": "9.1.1",
"#ngx-translate/http-loader": "2.0.1",
"#types/arcgis-js-api": "^4.4.0",
"#types/node": "9.4.0",
"angular2-esri-loader": "^1.0.0",
"cerialize": "^0.1.18",
"chart.js": "2.7.1",
"core-js": "^2.5.1",
"esri-loader": "^1.1.0",
"fullcalendar": "3.7.0",
"intl": "^1.2.5",
"jquery": "3.2.1",
"moment": "2.18.1",
"nanoscroller": "0.8.7",
"ngx-perfect-scrollbar": "5.3.4",
"primeng": "5.2.0",
"quill": "1.1.8",
"rxjs": "5.5.2",
"web-animations-js": "2.3.1",
"zone.js": "0.8.18"
},
"devDependencies": {
"#angular/cli": "^1.6.5",
"#angular/compiler-cli": "^5.2.0",
"#types/jasmine": "2.5.53",
"#types/jasminewd2": "2.0.2",
"#types/node": "6.0.60",
"codelyzer": "4.0.1",
"jasmine-core": "2.6.4",
"jasmine-spec-reporter": "4.1.1",
"karma": "1.7.1",
"karma-chrome-launcher": "2.1.1",
"karma-cli": "1.0.1",
"karma-jasmine": "1.1.0",
"karma-jasmine-html-reporter": "0.2.2",
"karma-coverage-istanbul-reporter": "1.3.0",
"protractor": "5.1.2",
"ts-node": "3.2.0",
"tslint": "5.7.0",
"typescript": "2.4.2"
}
}
The problem was caused by a local file .npmrc which contained the line always-auth = true. Removing this line resolved the issue. I have no idea how a 404 error is related to authentication, but noticed that after I switched to a mirror registry, it suddenly reported E401 instead of E404 like the official registry.
In my case, such issue was resolved by adding #latest to the command.
npm install -g #angular/cli#latest

Module build failed: ReferenceError: [BABEL] Unknown option: /Users/Will/.babelrc.presets

So I am totally baffled by this. My team is running on the same branch, same commit of code. I'm the only one having this issue. Here's the full stack trace:
Module build failed: ReferenceError: [BABEL] /Users/Will/Brandzooka/visibl-front_end/node_modules/eslint-loader/index.js!/Users/Will/Brandzooka/visibl-front_end/app/index.jsx: Unknown option: /Users/Will/.babelrc.presets
at Logger.error (/Users/Will/Brandzooka/visibl-front_end/node_modules/babel-core/lib/transformation/file/logger.js:58:11)
at OptionManager.mergeOptions (/Users/Will/Brandzooka/visibl-front_end/node_modules/babel-core/lib/transformation/file/options/option-manager.js:126:29)
at OptionManager.addConfig (/Users/Will/Brandzooka/visibl-front_end/node_modules/babel-core/lib/transformation/file/options/option-manager.js:107:10)
at OptionManager.findConfigs (/Users/Will/Brandzooka/visibl-front_end/node_modules/babel-core/lib/transformation/file/options/option-manager.js:168:35)
at OptionManager.init (/Users/Will/Brandzooka/visibl-front_end/node_modules/babel-core/lib/transformation/file/options/option-manager.js:229:12)
at File.initOptions (/Users/Will/Brandzooka/visibl-front_end/node_modules/babel-core/lib/transformation/file/index.js:147:75)
at new File (/Users/Will/Brandzooka/visibl-front_end/node_modules/babel-core/lib/transformation/file/index.js:137:22)
at Pipeline.transform (/Users/Will/Brandzooka/visibl-front_end/node_modules/babel-core/lib/transformation/pipeline.js:164:16)
at transpile (/Users/Will/Brandzooka/visibl-front_end/node_modules/babel-loader/index.js:12:22)
at Object.module.exports (/Users/Will/Brandzooka/visibl-front_end/node_modules/babel-loader/index.js:69:12)
I've come across multiple answers that all relate to Babel 6 usage, which doesn't currently apply to me.
I've tried:
Uninstalling and reinstalling node and npm versions (via nvm)
Blowing away all the node modules, and reinstalling
npm cache clean
Blowing away repo, and re-cloning
For good measure, restarting my machine
Im running node v0.12.9 & npm v2.14.9
Here's my package.json
{
"version": "0.0.0",
"main": "app/index.js",
"private": true,
"scripts": {
"build": "CONFIG_ENV=dev Q_DEBUG=1 time ./node_modules/.bin/webpack --config conf/webpack.production.js",
"build:prod": "CONFIG_ENV=production time ./node_modules/.bin/webpack --config conf/webpack.production.js",
"build:stage": "CONFIG_ENV=stage time ./node_modules/.bin/webpack --config conf/webpack.production.js",
"deploy:codeship-getvisibl": "time firebase deploy --token $FIREBASETOKEN",
"deploy:codeship-stage": "time firebase deploy --token $FIREBASETOKEN --project firebase-visibl-stage",
"deploy:stage": "firebase use firebase-visibl-stage && firebase deploy",
"lint": "PATH=$PATH:/usr/local/bin time ./node_modules/eslint/bin/eslint.js --cache --format 'node_modules/eslint-friendly-formatter' --ext .js --ext .jsx --config .eslintrc app/",
"migrate": "babel-node --stage 1 migrate.js",
"start": "CONFIG_ENV=dev Q_DEBUG=1 ./node_modules/.bin/webpack-dev-server --config conf/webpack.config.js --hot --progress --inline --content-base ./build",
"start:prod": "CONFIG_ENV=production Q_DEBUG=1 ./node_modules/.bin/webpack-dev-server --config conf/webpack.config.js --hot --progress --inline --content-base ./build",
"debug": "CONFIG_ENV=dev Q_DEBUG=1 time ./node_modules/.bin/mocha debug --full-trace --colors --recursive app/mochaNodeSetup.js app",
"test": "CONFIG_ENV=dev Q_DEBUG=1 time ./node_modules/.bin/mocha --full-trace --colors --bail --recursive app/mochaNodeSetup.js app"
},
"dependencies": {
"#brandzooka/client": "*",
"#brandzooka/models": "*",
"autoprefixer-loader": "2.0.0",
"aws-sdk": "^2.3.7",
"babel-core": "5.8.38",
"babel-loader": "5.3.2",
"baconjs": "0.7.66",
"bluebird": "2.10.1",
"bootstrap-sass": "3.3.5",
"bootstrap-slider": "4.10.0",
"chai": "3.0.0",
"chai-immutable": "1.0.2",
"classnames": "2.1.2",
"clear-require": "^1.0.1",
"cls-bluebird": "^1.0.1",
"css-loader": "0.15.1",
"dom-scroll-into-view": "1.2.0",
"eslint": "1.4.3",
"eslint-friendly-formatter": "1.0.8",
"eslint-loader": "^1.0.0",
"eslint-plugin-mocha": "0.4.0",
"eslint-plugin-react": "3.4.1",
"exports-loader": "0.6.2",
"file-loader": "0.8.4",
"immutable": "3.7.4",
"immutable-form-validation": "1.0.4",
"imports-loader": "0.6.4",
"jquery": "2.1.4",
"jsdom": "2.0.0",
"json-loader": "0.5.2",
"lodash": "3.10.1",
"mocha": "2.2.5",
"moment": "2.10.3",
"node-libs-browser": "0.5.2",
"node-sass": "3.2.0",
"nomnom": "^1.8.1",
"null-loader": "0.1.1",
"phantomjs": "1.9.18",
"precommit-hook": "2.0.1",
"q": "1.4.1",
"query-string": "3.0.3",
"rc-form-validation": "2.4.12",
"react": "^0.14.0",
"react-addons-pure-render-mixin": "0.14.0",
"react-addons-test-utils": "0.14.0",
"react-bootstrap": "0.29.5",
"react-bootstrap-daterangepicker": "0.2.5",
"react-dom": "0.14.0",
"react-dropzone": "1.2.2",
"react-hot-loader": "1.2.7",
"react-moment-proptypes": "0.0.5",
"react-router": "0.13.5",
"react-slick": "0.12.2",
"readline2": "^1.0.1",
"reflux": "0.4.1",
"reflux-core": "0.3.0",
"reflux-promise": "1.0.4",
"sass-loader": "1.0.2",
"sha.js": "2.4.5",
"sinon": "1.15.4",
"sinon-chai": "2.8.0",
"sinon-react": "0.2.1",
"style-loader": "0.12.3",
"superagent": "1.2.0",
"superagent-promise": "1.0.0",
"url": "0.10.3",
"url-loader": "0.5.6",
"uuid": "2.0.2",
"valid-url": "1.0.9",
"whatwg-fetch": "0.9.0"
},
"devDependencies": {
"babel": "5.8.38",
"babel-eslint": "^6.0.0-beta.6",
"chai-spies": "^0.7.1",
"clean-webpack-plugin": "0.1.3",
"estraverse": "^4.2.0",
"extract-text-webpack-plugin": "0.8.2",
"firebase-token-generator": "^2.0.0",
"html-webpack-plugin": "1.5.2",
"pg": "^4.4.2",
"pg-parse-float": "0.0.1",
"webpack": "*",
"webpack-dev-server": "*"
}
}
Any hot ideas out there? 3 hours in, I can't even get the error message to change.
The config path /Users/Will/.babelrc.presets means you have a .babelrc file in /Users/Will/, and it has a "presets" key because it appears to be a config file for Babel 6.
Presumably you have a .babelrc at /Users/Will/Brandzooka/visibl-front_end/.babelrc to configure your Babel 5 install, but Babel 5 does not stop traversing upward looking for other configs unless you tell it to (Babel 6 stops at the first config), so it will also look farther up and error out on the Babel 6 config in your home directory.
This leaves you with a few options:
Delete /Users/Will/.babelrc, because Babel config files should live in the project they apply to, not in your home.
If that is a no-go, open (and maybe create) /Users/Will/Brandzooka/visibl-front_end/.babelrc and make sure it has the key "breakConfig": true to tell Babel 5 to stop looking in parent directories for other config files.

Resources