How can I upgrade Node JS to v14.x with Ionic 3? - node.js

According to errors I faced with this TS/Node project (for a simple TypeScript only REST API) the suggested fix (mentioned here (https://github.com/heineiuo/rippledb/issues/148)) is that I needed something like Node v14.x
I initially jumped all the way v18.x and that tutorial project built and worked. https://www.mongodb.com/compatibility/using-typescript-with-mongodb-tutorial
However, Node 18.x and even downgrading to Node v14.15.5 breaks the build apk and browser processes in one ionic 3 project with the following ionic configuration.
$ ionic info
Ionic:
Ionic CLI : 6.13.1 (C:\Users\AXM\AppData\Roaming\npm\node_modules\#ionic\cli)
Ionic Framework : ionic-angular 3.9.2
#ionic/app-scripts : 3.2.4
Cordova:
Cordova CLI : 11.0.0
Cordova Platforms : android 10.1.2, browser 5.0.3
Cordova Plugins : cordova-plugin-ionic-webview 4.1.3, (and 15 other plugins)
Utility:
cordova-res : 0.15.3
native-run : not installed
System:
Android SDK Tools : 26.1.1 (C:/Users/AXM/AppData/Local/Android/Sdk)
NodeJS : v10.16.0 (C:\Program Files\nodejs\node.exe)
npm : 6.9.0
OS : Windows 10 ...really 11 :)
The initial complaints I did not log I believe where about sass failing.
Googling I run into this post though not specifically about "ionic 3" saying downgrade.
Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (88)
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve",
"watch": "ionic-app-scripts watch && beep ",
"serve:before": "watch",
"emulate:before": "build",
"deploy:before": "build",
"build:before": "build",
"run:before": "build",
"run:after": "beep",
"serve:after": "beep",
"beep": "bash.exe beep.sh",
"beep0": "bash.exe -c \"echo -en '\\a' \" ",
"releasePWA": "ionic cordova build browser --prod --release"
},
"dependencies": {
"#angular/common": "5.0.3",
"#angular/compiler": "5.0.3",
"#angular/compiler-cli": "5.0.3",
"#angular/core": "5.0.3",
"#angular/forms": "5.0.3",
"#angular/platform-browser": "^5.0.3",
"#angular/platform-browser-dynamic": "5.0.3",
"#ionic-native/android-full-screen": "^4.20.0",
"#ionic-native/app-version": "^4.20.0",
"#ionic-native/clipboard": "^4.20.0",
"#ionic-native/core": "4.5.2",
"#ionic-native/document-viewer": "^4.7.0",
"#ionic-native/file": "^4.7.0",
"#ionic-native/file-transfer": "^4.7.0",
"#ionic-native/in-app-browser": "4.5.2",
"#ionic-native/ionic-webview": "^5.36.0",
"#ionic-native/social-sharing": "4.5.2",
"#ionic-native/splash-screen": "^4.7.0",
"#ionic-native/status-bar": "4.5.2",
"#ionic-native/toast": "4.6.0",
"#ionic/pro": "1.0.16",
"#ionic/storage": "2.1.3",
"#types/youtube": "0.0.46",
"archiver": "^5.3.1",
"child_process": "^1.0.2",
"clipboard-js": "0.3.3",
"com.verso.cordova.clipboard": "https://github.com/VersoSolutions/CordovaClipboard.git",
"cordova-browser": "5.0.3",
"cordova-clipboard": "~1.0.0",
"cordova-plugin-device": "1.1.4",
"cordova-plugin-file": "^6.0.1",
"cordova-plugin-file-transfer": "^1.7.1",
"cordova-plugin-fullscreen": "^1.2.0",
"cordova-plugin-inappbrowser": "~1.7.1-dev",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-plugin-x-socialsharing": "~5.1.6",
"cordova-plugin-x-toast": "~2.6.0",
"cordova-sqlite-storage": "~2.0.3",
"danielsogl-cordova-plugin-clipboard": "1.0.2",
"ionic-angular": "3.9.2",
"ionic-plugin-keyboard": "~2.2.1",
"ionicons": "3.0.0",
"node-apk": "^1.1.1",
"rxjs": "5.5.2",
"sw-toolbox": "3.6.0",
"url-exist": "^3.0.0",
"zone.js": "0.8.18"
},
"devDependencies": {
"#ionic/app-scripts": "^3.2.4",
"#types/node": "^9.6.61",
"cordova-android": "^10.1.2",
"cordova-plugin-apkupdater": "^4.0.0",
"cordova-plugin-app-version": "^0.1.14",
"cordova-plugin-ionic-webview": "^4.1.3",
"tslint": "^5.10.0",
"tslint-ionic-rules": "0.0.16",
"typescript": "^2.8.3",
"viewport-units-buggyfill": "0.6.2"
},
"cordovaPlugins": [
"cordova-plugin-whitelist",
"cordova-plugin-console",
"cordova-plugin-statusbar",
"cordova-plugin-device",
"cordova-plugin-splashscreen",
"ionic-plugin-keyboard",
"cordova-plugin-x-socialsharing"
],
"cordovaPlatforms": [
{
"platform": "android",
"version": "",
"locator": "android"
},
{
"platform": "browser",
"version": "",
"locator": "browser"
}
],
"description": "UPS.ion: project",
"config": {
"ionic_source_map": "source-map",
"ionic_copy": "./copy.config.js"
},
"cordova": {
"plugins": {
"cordova-sqlite-storage": {},
"cordova-plugin-x-toast": {},
"cordova-clipboard": {},
"cordova-plugin-file-transfer": {},
"cordova-plugin-file": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-device": {},
"cordova-plugin-ionic-webview": {
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
},
"com.verso.cordova.clipboard": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-x-socialsharing": {},
"cordova-plugin-fullscreen": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-apkupdater": {},
"cordova-plugin-app-version": {}
},
"platforms": [
"browser"
]
}
}
Anyway I am poor at resolving issues like these here is my package.json I am not back to Node v10.16.0, not fully recovered with some weird new issues when I build
ionic cordova build browser --prod --release
I get
> ionic-app-scripts.cmd build --prod --target cordova --platform browser
[07:44:15] ionic-app-scripts 3.2.4
[07:44:15] build prod started ...
[07:44:15] clean started ...
[07:44:15] clean finished in 2 ms
[07:44:15] copy started ...
[07:44:15] deeplinks started ...
[07:44:15] deeplinks finished in 293 ms
[07:44:15] ngc started ...
[07:44:20] typescript error
Invalid provider for the NgModule 'AppModule in S:/_W/ARP/UPS.ion/SRC/UPS.ion.3/src/app/app.module.ts' -
only instances of Provider and Type are allowed, got: [[object Object], Clipboard in
S:/_W/ARP/UPS.ion/SRC/UPS.ion.3/node_modules/#ionic-native/clipboard/index.d.ts, Toast in
S:/_W/ARP/UPS.ion/SRC/UPS.ion.3/node_modules/#ionic-native/toast/index.d.ts, SocialSharing in
S:/_W/ARP/UPS.ion/SRC/UPS.ion.3/node_modules/#ionic-native/social-sharing/index.d.ts, AndroidFullScreen in
S:/_W/ARP/UPS.ion/SRC/UPS.ion.3/node_modules/#ionic-native/android-full-screen/index.d.ts, ?null?]
[07:44:20] ionic-app-script task: "build"
[07:44:20] Error: The Angular AoT build failed. See the issues above
Error: The Angular AoT build failed. See the issues above
at S:\_W\ARP\UPS.ion\SRC\UPS.ion.3\node_modules\#ionic\app-scripts\dist\aot\aot-compiler.js:237:55
at step (S:\_W\ARP\UPS.ion\SRC\UPS.ion.3\node_modules\#ionic\app-scripts\dist\aot\aot-compiler.js:32:23)
at Object.next (S:\_W\ARP\UPS.ion\SRC\UPS.ion.3\node_modules\#ionic\app-scripts\dist\aot\aot-compiler.js:13:53)
at fulfilled (S:\_W\ARP\UPS.ion\SRC\UPS.ion.3\node_modules\#ionic\app-scripts\dist\aot\aot-compiler.js:4:58)
[ERROR] An error occurred while running subprocess ionic-app-scripts.
ionic-app-scripts.cmd build --prod --target cordova --platform browser exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
I have googled among many other things
Invalid provider for the NgModule 'AppModule
Error: The Angular AoT build failed
and made many guess work attempts (npm uninstall this... npm install that...).
I also cleaned all lint errors, but it did not help either.
Funny but deleting the 5 providers list shown below lines 120..124 in app.modules.ts makes the build happy but the browser build won't run and the same with the APK build.
[![enter image description here][1]][1]
Perhaps there is something else that needs to be upgraded to make it possible to have a newer version of node that works for both projects (I can't afford to loose my ionic3 project).
Sorry it's complicated...

Using different versions of Node to run each app might help. The tool NVM is great for this, go ahead and install it if you haven't already.
In one shell, install your newer Node version, e.g. nvm install lts/gallium and nvm use lts/gallium. Wipe out node_modules and reinstall dependencies (rm -rf ./node_modules && npm i) and run your server stuff there.
In another shell, install the older Node version, e.g. nvm install lts/erbium and nvm use lts/erbium. Again, wipe out node_modules and reinstall dependencies (rm -rf ./node_modules && npm i) and run your Ionic 3 project there.
If that doesn't help, putting a gutted version of your app on Github with instructions to replicate the bug would best enable further debugging.

Related

Issue Building Electron App with Opencv4nodejs on Windows 10

I have built an electron app that uses tensorflow and opencv4nodejs.
The app works well when I use npm start. However, when I try to build my app, it bombs out with the following error:
The issue here is that I have not built the opencv4nodejs from source. Instead I manually installed opencv and then disabled autobuild to install it for my app.
From the error, I see that it is looking for a lib directory under opencv-build but it is simply not there.
Is there a way to NOT have anything rebuilt since I already have all the modules built for Windows 10?
Am sure this is something simple but have run up against a brick wall for this.
Here is my package.json
`
{
"name": "myApp",
"version": "0.0.1",
"description": "My Electron App",
"main": "main.js",
"license": "abc",
"private": true,
"scripts": {
"postinstall": "install-app-deps",
"start": "electron .",
"build": "electron-packager . nGage --platform win32 --arch x64 --out dist/ --icon image/nGage-Icon.ico --overwrite",
"setup": "electron-installer-windows --src dist/nGage-win32-x64/ --dest dist/installers/ --config config.json --overwrite",
"dist": "build"
},
"build": {
"appId": "com.electron.app",
"publish": [
{
"provider": "generic",
"url": "abc"
}
],
"win": {
"target": [
{
"target": "nsis",
"arch": [
"x64"
]
}
],
"certificateFile": "cert/abc",
"certificatePassword": "xyz"
},
"asar": false,
"nsis": {
"oneClick": true,
"perMachine": false,
"artifactName": "${productName}-Setup-${version}-x64.${ext}"
}
},
"author": {
"name": "ABC",
"email": "xyz#abc.com",
"url": "www.abc.com"
},
"devDependencies": {
"electron": "^9.0.3",
"electron-builder": "^19.53.6",
"electron-installer-windows": "^0.2.0",
"electron-packager": "^8.5.2",
"electron-winstaller": "^2.5.2",
"grunt-electron-installer": "^2.1.0"
},
"dependencies": {
"#tensorflow/tfjs": "^2.0.0",
"#tensorflow/tfjs-node": "^2.0.0",
"auto-launch": "^5.0.1",
"cron": "^1.2.1",
"electron-config": "^0.2.1",
"electron-positioner": "^3.0.0",
"electron-squirrel-startup": "^1.0.0",
"electron-updater": "^2.19.0",
"electron-window": "^0.8.1",
"graceful-fs": "^4.1.11",
"homedir": "^0.6.0",
"https": "^1.0.0",
"opencv4nodejs": "^5.6.0",
"request": "^2.88.2",
"url": "^0.11.0",
"username": "^3.0.0",
"util": "^0.12.3",
"windows-build-tools": "^5.2.2"
}
}
`
Any insights will be most helpful!
Thanks,
Arun
So I realised that I needed to set the following environment variables before doing npm run build
since I had used them while build opencv4nodejs. Here is what I have taken from the the opencv4nodejs site.
`
Installing OpenCV Manually
Setting up OpenCV on your own will require you to set an environment variable to prevent the auto build script to run:
# linux and osx:
export OPENCV4NODEJS_DISABLE_AUTOBUILD=1
# on windows:
set OPENCV4NODEJS_DISABLE_AUTOBUILD=1
Windows
You can install any of the OpenCV 3 or OpenCV 4 releases manually or via the Chocolatey package manager:
# to install OpenCV 4.1.0
choco install OpenCV -y -version 4.1.0
Note, this will come without contrib modules. To install OpenCV under windows with contrib modules you have to build the library from source or you can use the auto build script.
Before installing opencv4nodejs with an own installation of OpenCV you need to expose the following environment variables:
OPENCV_INCLUDE_DIR pointing to the directory with the subfolder opencv2 containing the header files
OPENCV_LIB_DIR pointing to the lib directory containing the OpenCV .lib files
Also you will need to add the OpenCV binaries to your system path:
add an environment variable OPENCV_BIN_DIR pointing to the binary directory containing the OpenCV .dll files
append ;%OPENCV_BIN_DIR%; to your system path variable
`

Why does hot reloading not work for reactjs visual studio 2019 template

I've been fooling around with ReactJS on my computer at home and at work. At home, I'm using Visual Studio 2019, NodeJS 10.16.2, NPM 6.9.0, and webpack 3.11.0.
Hot reloading DID work when I first started my project. At some point, it stopped working. I thought perhaps I had inadvertently made some change to a package or setting, so I created a completely new solution from scratch, but it still doesn't work. So apparently I've done something to my machine, but I can't imagine what.
At work, also using Visual Studio 2019 (I have to check the versions of the other stuff), hot reloading DOES work.
Can anyone think of something I might have done by accident that caused it to stop working? Or a way to try to make it work again? I've tried just about everything I found online, but much of it isn't recent, and none of it helped.
package.json file as requested:
{
"name": "jobs",
"version": "0.1.0",
"private": true,
"dependencies": {
"axios": "^0.19.0",
"bootstrap": "^4.1.3",
"faye-websocket": "^0.11.3",
"jquery": "3.4.1",
"lodash": "^4.17.15",
"merge": "^1.2.1",
"oidc-client": "^1.9.1",
"react": "16.9.0",
"react-dev-utils": "^9.0.3",
"react-dom": "^16.0.0",
"react-loading-overlay": "^1.0.1",
"react-router-bootstrap": "0.25.0",
"react-router-dom": "5.0.1",
"react-scripts": "3.1.1",
"react-spinners": "0.6.1",
"react-transition-group": "^4.2.2",
"reactstrap": "8.0.1",
"rimraf": "3.0.0",
"toastr": "^2.1.4"
},
"devDependencies": {
"ajv": "^6.9.1",
"cross-env": "^5.2.1",
"eslint": "6.3.0",
"eslint-config-react-app": "5.0.1",
"eslint-plugin-flowtype": "4.2.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-react": "^7.14.3"
},
"eslintConfig": {
"extends": "react-app"
},
"scripts": {
"start": "rimraf ./build && react-scripts start",
"build": "react-scripts build",
"test": "cross-env CI=true react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"lint": "eslint ./src/"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
I had the same problem with a fresh install of Visual Studio 2019 and had to install the Web Essentials extension that contains the Browser Reload on Save extension.
set cache: false in webpack config. which will solve the HMR problem
https://webpack.js.org/configuration/other-options/#cache
for reference you can refer the given link
I think it's template problem. I suggest you to uninstall reactjs template and adding your own configurations using webpack.
follow this manual https://webpack.js.org/guides/getting-started/
and you can manually load Bundle file from your project
If you are running the application with visual studio and for some reason ran `npm run build, you'we got a /build folder aligned with your /public folder. Visual Studio will then prefer the /build folder thus your hot reload will not work.
Delete the /build folder, rebuild the Visual Studio application and don't use 'npm run build' while developing.

Bitbucket Pipelines from Docker Image has Missing NPM Modules

Question
What is wrong with my Dockerfile or bitbucket-pipelines.yml? Why are modules missing from the bitbucket pipelines environment?
Error
When I try to npm run build my Vue2 project with webpack using Bitbucket Pipelines, I get errors regarding missing modules.
From Logs
npm run build
> people-is#1.0.0 build /opt/atlassian/pipelines/agent/build
> node build/build.js
module.js:549
throw err;
^
Error: Cannot find module 'cli-spinners'
Files
Here are the files for configuration.
Dockerfile - builds cportwine/people-is
FROM node:8.10.0
RUN npm install
RUN npm install -g firebase-tools
CMD [ "npm", "run", "build" ]
bitbucket-pipelines.yml
image:
name: cportwine/people-is
pipelines:
default:
- step:
script:
- npm run build
package.json
{
"name": "people-is",
"version": "1.0.0",
"description": "A Vue.js project",
"author": "cportwine",
"private": true,
"scripts": {
"dev": "node build/dev-server.js",
"start": "node build/dev-server.js",
"build": "node build/build.js",
"deploy": "firebase deploy --token $FIREBASE_TOKEN"
},
"dependencies": {
"rxjs": "^5.5.8",
"uuid": "^3.2.1",
"vue": "^2.5.16",
"vue-json-excel": "^0.1.9",
"vue-router": "^2.8.1",
"vue-rx": "^5.0.0",
"vuefire": "^1.4.5",
"vuetify": "^0.15.2"
},
"devDependencies": {
"autoprefixer": "^7.2.6",
"babel-core": "^6.22.1",
"babel-loader": "^7.1.4",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-preset-env": "^1.6.1",
"babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.22.0",
"chalk": "^2.3.2",
"connect-history-api-fallback": "^1.5.0",
"copy-webpack-plugin": "^4.5.1",
"css-loader": "^0.28.11",
"cssnano": "^3.10.0",
"eslint": "^4.19.1",
"eslint-config-standard": "^11.0.0",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.9.0",
"eslint-plugin-html": "^4.0.2",
"eslint-plugin-promise": "^3.7.0",
"eslint-plugin-standard": "^3.0.1",
"eventsource-polyfill": "^0.9.6",
"express": "^4.16.3",
"extract-text-webpack-plugin": "^2.0.0",
"file-loader": "^0.11.1",
"firebase": "^4.12.0",
"firebase-tools": "^3.17.7",
"friendly-errors-webpack-plugin": "^1.1.3",
"html-webpack-plugin": "^2.28.0",
"http-proxy-middleware": "^0.17.3",
"opn": "^5.3.0",
"optimize-css-assets-webpack-plugin": "^2.0.0",
"ora": "^1.4.0",
"rimraf": "^2.6.0",
"semver": "^5.5.0",
"shelljs": "^0.7.6",
"url-loader": "^0.5.8",
"vue-loader": "^13.7.1",
"vue-style-loader": "^3.1.2",
"vue-template-compiler": "^2.5.16",
"vuex": "^2.5.0",
"webpack": "^2.6.1",
"webpack-bundle-analyzer": "^2.11.1",
"webpack-dev-middleware": "^1.12.2",
"webpack-hot-middleware": "^2.21.2",
"webpack-merge": "^4.1.2"
},
"engines": {
"node": ">=8.10.0",
"npm": ">= 5.6.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
],
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://chaddportwine#bitbucket.org/jahnelgroup/people-is.git"
},
"keywords": [],
"license": "ISC",
"homepage": "https://bitbucket.org/jahnelgroup/people-is#readme"
}
What I see
When I ls the node_modules folder in both environments, they do not match. Modules are missing from bitbucket pipelines.
local folder
people-is/node_modules
...
chalk
char-spinner
chardet
check-types
chokidar
chownr
cipher-base
circular-json
cjson
clap
class-utils
clean-css
cli-boxes
cli-cursor
cli-spinners
cli-table
cli-table2
cli-width
cliui
...
bitbucket folder
/opt/atlassian/pipelines/agent/build/node_modules
Woah, missing modules!
...
chalk
cli-cursor
co
...
What I have tried
I added a command to the bitbucket-pipelines.yml to npm install before I build.
bitbucket-pipelines.yml
image:
name: cportwine/people-is
pipelines:
default:
- step:
script:
- npm install
- npm run build
This adds some additional modules (like cli-spinners from the error) to /opt/atlassian/pipelines/agent/build/node_modules.
bitbucket folder
/opt/atlassian/pipelines/agent/build/node_modules
...
chalk
char-spinner
chardet
check-types
chokidar
chownr
cipher-base
circular-json
cjson
clap
class-utils
clean-css
cli-boxes
cli-cursor
cli-spinners
cli-table
cli-table2
cli-width
cliui
clone
clone-response
co
...
However, the build command still fails, due to a different missing module.
Error
> people-is#1.0.0 build /opt/atlassian/pipelines/agent/build
> node build/build.js
module.js:549
throw err;
^
Error: Cannot find module './_safeGet'
Solutions
I can now build the app, but I don't know why!
1 - Simplify the Dockerfile
I removed all the npm commands. Maybe the npm install commands were redundant? There was no advantage using the Docker Image to pre-install npm packages.
2 - Remove Node_Modules before install
Using the bitbucket-pipelines.yml, remove the node_modules folder, and then perform npm install -g npm and npm install and npm install -g firebase-tools.
File Changes
bitbucket-pipelines.yml (added lines)
image:
name: cportwine/people-is
pipelines:
default:
- step:
script:
- rm -r node_modules <---- remove
- npm install -g npm <---- install
- npm install <---- install
- npm install -g firebase-tools <---- install
- npm run build
Dockerfile (lines removed)
FROM node:8.10.0
<---- remove
CMD [ "npm", "run", "build" ]
Answer ?
I'm not sure why moving all the npm install stuff into the bitbucket.pipelines.yml solved my issue building the project. I thought Docker would enable me to define my environment, e.g., install a version of node/npm and firebase. And pipelines would "run" that.
If someone could explain what I am missing, I would accept that answer.
Answer
I received support from the Atlassian Team
Leave npm install -g firebase in the docker image.
Move npm install from the docker image to the
bitbucket-pipelines.yml file.
Reason
The node_modules folder was listed in .gitignore
tl;dr
My mistake - I forgot about .gitignore and how that affects the node_modules folder in source control, e.g., Bitbucket Pipelines.
I was looking at my local node_modules folder and building locally which worked.
However
The node_modules in source control, by design, is not in-sync with my local folder because it's included in the .gitignore file.
So
It was necessary for me to rm node_modules and npm install using the bitbucket-pipelines.yml. Now, BitPipes finds the modules I have installed locally.
This is sort of the point of maintaining the package.json, but I got confused.

npm ERR! Cannot read property 'pause' of undefined --Bluemix

I am trying to deploy a Sails.js app to Bluemix and we are getting the following error during the deploy stage in the toolchain on Bluemix (When the CF PUSH command is called):
npm ERR! Cannot read property 'pause' of undefined
I understand the trace goes to the npm-error.log file, however, I haven't been able to get to it as we cannot ssh in to see whats in the file as the application is in its "off" state after a bad deploy.
This same code was successfully deployed with both Cf push {app name}} and through a simple build and deploy toolchain in Bluemix just 8 days ago.
In the build stage I can run Npm install and npm update just fine. However, it seems to do this again in the deploy stage regardless and it fails. Here is some detail on this failure
NODE_ENV=production
NPM_CONFIG_LOGLEVEL=error
NPM_CONFIG_PRODUCTION=true
Visit http://docs.cloudfoundry.org/buildpacks/node/index.html#vendoring
NODE_HOME=/tmp/app/.cloudfoundry/0/node
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
Restoring cache
Loading 3 from cacheDirectories (default):
- .npm
- .cache/yarn (not cached - skipping)
- bower_components (not cached - skipping)
Installing node modules (package.json) Building dependencies
sails#0.12.13 preinstall /tmp/app/node_modules/sails
node ./lib/preinstall_npmcheck.js
Sails.js Installation: Checking npm-version successful
npm ERR! Cannot read property 'pause' of undefined
npm ERR! /tmp/app/.npm/_logs/2017-09-09T17_02_48_660Z-debug.log
**ERROR** Unable to build dependencies: exit status 1
Failed to compile droplet
Exit status 223
Staging failed: Exited with status 223
Destroying container
npm ERR! A complete log of this run can be found in:
Successfully destroyed container
Package.json file
{
"name": "myApp",
"private": true,
"version": "0.0.1",
"description": "Stuff my app does",
"keywords": [
"Cool Apps"
],
"dependencies": {
"bcryptjs": "^2.4.3",
"cacheman": "^2.2.1",
"ejs": "2.3.4",
"elasticsearch": "^13.0.0-rc2",
"find-remove": "^1.0.1",
"fs": "0.0.1-security",
"grunt": "1.0.1",
"grunt-contrib-clean": "1.0.0",
"grunt-contrib-coffee": "1.0.0",
"grunt-contrib-concat": "1.0.1",
"grunt-contrib-copy": "1.0.0",
"grunt-contrib-cssmin": "1.0.1",
"grunt-contrib-jst": "1.0.0",
"grunt-contrib-less": "1.3.0",
"grunt-contrib-uglify": "1.0.1",
"grunt-contrib-watch": "1.0.0",
"grunt-sails-linker": "~0.10.1",
"grunt-sync": "0.5.2",
"include-all": "^1.0.0",
"jsonwebtoken": "^7.3.0",
"moment": "^2.18.1",
"moment-timezone": "^0.5.13",
"passport": "^0.2.x",
"passport-http-bearer": "^1.0.1",
"passport-idaas-openidconnect": "^1.1.0",
"passport-local": "^1.0.0",
"rc": "1.0.1",
"request": "^2.81.0",
"request-promise": "^4.2.0",
"sails": "~0.12.13",
"sails-disk": "~0.10.9",
"sails-mongo": "^0.12.2",
"stream": "0.0.2",
"uuid-1345": "^0.99.6",
"validator": "^7.0.0",
"natural-sort": "^1.0.0"
},
"scripts": {
"start": "node app.js"
},
"engines": {
"node": "^8.0.x",
"npm": "^5.0.x"
},
"main": "app.js",
"author": "Scott N",
"license": ""
}
Things I've tried so far.
-change node versions
-changed npm versions
-change dependencies versions to include the ^ prefix
-removed all dependencies but Sails in the package.json file
So Sails.js and the Nodebuildpack/Bluemix aren't playing well with each other.
Any help would be appreciated.
Thank you
It happens to me just the same. and I've to roll back the prev version of npm: 5.3.0 and it's working now. (BTW: macOS)
The error only happens when I update my npm version like this:
Update available 5.3.0 → 5.4.1
Run npm i -g npm to update
The best way to handle it is to update your package.json to use engines like so
"description": "a Sails application",
"keywords": [],
"engines": {
"node": "6.10.1",
"npm": "5.3.0"
},
Got this issue while trying to push to heroku which seems to be the npm version specified by #m-t, and also specifying the versions like above makes ibm bluemix pick it up as default node engine instead of using the latest stable version.
And don't forget to always specify your node and npm versions directly, instead of adding tilde or caret, this just to be safe. check https://stackoverflow.com/a/22345808/5836034 for more about tilde and caret
you can still check #sai-vennam answer here for more info
So I rolled back the sails version in the package.json file from 0.12 to 0.11 and it deployed fine. So CF PUSH and the newest sails version are not getting along on Bluemix. This was using Node 8.0 and NPM version ^5.0.x

Ionic 2 Build TypeError: Cannot read property 'AssetUrl' of undefined

Ionic 2 failed CLI build giving me the following error: "TypeError: Cannot read property 'AssetUrl' of undefined".
My research lead me to this thread and this one.
Both threads suggest to modify the "package.json" file and to remove the "^" sign in front of the version in "dependencies" and "devDependencies".
I did that and then CLI:
ionic rm platform android
ionic add platform android
and finally: ionic build android
I still get the same error.
At some point in this thread , it suggests using some npm command I am not familiar with (yet), quoting it: "rm -rf node_modules and npm cache clean and a fresh npm install". I don't really understand what is under the hood of all this.
I would be grateful if someone come up with the magic solution to make the build run fine. But also I'd like to understand how "TypeError: Cannot read property 'AssetUrl' of undefined" could be linked with the "package.json"? I don't get why this error lead to that possible solution.
My version are:
npm 3.10.3
node 6.7.0
cordova 6.3.1
ionic 2.1.0
Here is my package.json as it looks now afer operating the suggestion read in both threads:
{
"name": "ionic-hello-world",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"build": "ionic-app-scripts build",
"watch": "ionic-app-scripts watch",
"serve:before": "watch",
"emulate:before": "build",
"deploy:before": "build",
"build:before": "build",
"run:before": "build"
},
"dependencies": {
"#angular/common": "2.0.0",
"#angular/compiler": "2.0.0",
"#angular/compiler-cli": "0.6.2",
"#angular/core": "2.0.0",
"#angular/forms": "2.0.0",
"#angular/http": "2.0.0",
"#angular/platform-browser": "2.0.0",
"#angular/platform-browser-dynamic": "2.0.0",
"#angular/platform-server": "2.0.0",
"ionic-angular": "2.0.0-rc.0",
"ionicons": "3.0.0",
"#ionic/storage": "1.0.3",
"ionic-native": "2.0.3",
"rxjs": "5.0.0-beta.12",
"zone.js": "0.6.21"
},
"devDependencies": {
"#ionic/app-scripts": "0.0.36",
"typescript": "2.0.3"
},
"description": "HelloWorld: An Ionic project",
"cordovaPlugins": [
"cordova-plugin-device",
"cordova-plugin-console",
"cordova-plugin-whitelist",
"cordova-plugin-splashscreen",
"cordova-plugin-statusbar",
"ionic-plugin-keyboard"
],
"cordovaPlatforms": []
}
I did in CLI within the folder of the projet an "npm install" + take away "^" sign in front of "dependencies" and "devDependencies" in package.json (as advised in the forum threads which are linked in my question). And it solved it.
You should also update #angular/compiler-cli to the latest version.
That should do the trick

Resources