jupyterlab-plotly build npm extensions failed to install on Linux - npm

This is to help those who face a similar issue. My builds were failing when trying to install the jupyterlab-plotly extension. My Jupyter Lab version is Version 1.2.6. The log was as follows:
[LabBuildApp] Building in /home/***/anaconda3/share/jupyter/lab
[LabBuildApp] Yarn configuration loaded.
[LabBuildApp] Node v6.13.1
[LabBuildApp] Building jupyterlab assets (build:prod:minimize)
[LabBuildApp] > node /home/***/anaconda3/lib/python3.7/site-packages/jupyterlab/staging/yarn.js install --non-interactive
[LabBuildApp] yarn install v1.15.2
[1/5] Validating package.json...
[2/5] Resolving packages...
warning jupyterlab-plotly > plotly.js > regl-splom > left-pad#1.3.0: use String.prototype.padStart()
warning jupyterlab-plotly > plotly.js > point-cluster > bubleify > buble > os-homedir#2.0.0: This is not needed anymore. Use `require('os').homedir()` instead.
[3/5] Fetching packages...
error ws#7.2.1: The engine "node" is incompatible with this module. Expected version ">=8.3.0". Got "6.13.1"
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
[LabBuildApp] npm dependencies failed to install
[LabBuildApp] Traceback (most recent call last):
[LabBuildApp] File "/home/***/anaconda3/lib/python3.7/site-packages/jupyterlab/debuglog.py", line 47, in debug_logging
yield
[LabBuildApp] File "/home/***/anaconda3/lib/python3.7/site-packages/jupyterlab/labapp.py", line 98, in start
command=command, app_options=app_options)
[LabBuildApp] File "/home/***/anaconda3/lib/python3.7/site-packages/jupyterlab/commands.py", line 459, in build
command=command, clean_staging=clean_staging)
[LabBuildApp] File "/home/***/anaconda3/lib/python3.7/site-packages/jupyterlab/commands.py", line 660, in build
raise RuntimeError(msg)
[LabBuildApp] RuntimeError: npm dependencies failed to install
[LabBuildApp] Exiting application: JupyterLab
~
~
"/tmp/jupyterlab-debug-7x6sz5zm.log" 34L, 1758C
Solution is in answers

The issue, as indicated by the log file, seemed to be that the node in my anaconda environment was outdated.
$ type node
node is hashed (/home/***/anaconda3/bin/node)
$ node --version
v6.13.1
Looking at the nodejs on my machine:
$ type nodejs
nodejs is hashed (/usr/bin/nodejs)
$ nodejs --version
v10.15.2
To get around this issue I did the following:
Navigated to node's parent directory
Made a backup of node just in case
Made a symlink to nodejs here named as "node"
Ran the build
Enabled the jupyterlab-plotly extension
Restarted the Jupyter Lab server
Commands were as follows:
cd /home/***/anaconda3/bin/
cp node node_bak
rm node
sudo ln -s /usr/bin/nodejs /home/***/anaconda3/bin/node
jupyter lab clean
jupyter lab build
After some time, the build concluded successfully.
I enabled the jupyterlab-plotly extension from the inbuild extension manager. And I restarted the server.
My pretty plots started rendering as intended after this. :) Hope this saves you some time.
Note: replace *** with the paths on your machine

I had the same error and simply updated the nodejs package on my environment.
conda update nodejs

Related

Archiving React Native project fails with PhaseScriptExecution failed with a nonzero exit code. Node in error message doesn't match installed version

The project was archiving fine before, but after installing yarn globally for a different project, it started failing with the following error:
Node found at: /opt/homebrew/Cellar/node/18.9.0/bin/node
$PROJECT_DIRECTORY/ios/Pods/../../node_modules/react-native/React/FBReactNativeSpec/../../scripts/react_native_pods_utils/script_phases.sh:
line 83: /opt/homebrew/Cellar/node/18.9.0/bin/node: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code
If I run node --version in my terminal, I get back v19.0.1.
I tried running the commands below to try and relink node but I get the same build errors.
sudo rm -f /usr/local/bin/node
sudo ln -s $(which node) /usr/local/bin/node
Figured out my problem. When running pod install for the first time, an .xcode.env.local was auto-generated in the /ios folder with $NODE_BINARY=/opt/homebrew/Cellar/node/18.9.0/bin/node. I updated it to the node version that I have installed, that had been updated when yarn was installed, and it's now working.

Not able to install Yarn through corepack

Environment: Windows, Node 16.18.0, Corepack 0.14.1
I am following these instructions to install Yarn.
When I run corepack prepare yarn#3.2.4 or corepack prepare yarn#3.2.4 --activate
I get the following error:
Preparing yarn#3.2.4... Internal Error: ENOENT: no such file or directory, stat 'C:\Users\rashiditaba\AppData\Local\node\corepack\yarn\3.2.4' Error: ENOENT: no such file or directory, stat 'C:\Users\***\AppData\Local\node\corepack\yarn\3.2.4'
Hello I experienced the same problem. Corepack is an experimental tool to help with managing versions of your package managers. Due to its experimental status, Corepack currently needs to be explicitly enabled to have any effect.
Disable Corepack with the command:
corepack disable
You will now be able to install yarn via npm:
npm install -g yarn --force
To check the installed version of yarn use:
yarn -v
To upgrade the version use (stable version 3.2.4):
yarn set version stable
Now you can enable corepack again (if it fails keep it disabled):
corepack enable
Try the failed command:
corepack prepare yarn#3.2.4 --activate
I leave you the link with the description of the solution:
https://nodejs.org/dist/latest/docs/api/corepack.html
I hope it helps you
From the error your getting it seems like you have to wrong directory PATH to yarn. Find the directory where yarn is installed and update it's PATH in the environment variables.

"appium &" won't start appium server in mac

I have downloaded all the required tools and able to set up environment variable.
macOS mojave : version 10.14.3
I have install node, appium and wd:
brew install node
npm install -g appium
npm install wd
when i try yo start appium server using appium & I got following error;
[1] 49460
-bash: appium: command not found
[1]+ Exit 127 appium
Updated:
None of app opens which is installed using npm command. The app installed using npm shows command not found error
It was working fine in macOs Mojave 10.14.2
Logs while using npm install -g appium
$npm install -g appium
npm WARN deprecated fsevents#2.0.1: Not Ready For Production
/Users/infotmt/bin/appium -> /Users/infotmt/lib/node_modules/appium/build/lib/main.js
> appium-chromedriver#4.9.0 install /Users/infotmt/lib/node_modules/appium/node_modules/appium-chromedriver
> node install-npm.js
[18:22:48] [Chromedriver Install] Installing Chromedriver version '2.44' for platform 'mac' and architecture '64'
[18:22:48] [Chromedriver Install] Opening temp file to write 'chromedriver_mac64' to...
[18:22:48] [Chromedriver Install] Opened temp file '/var/folders/ng/_2f_j78n1vg4gf8xnxvx9c780000gn/T/2019025-62054-1018qcf.8dtn/chromedriver_mac64.zip'
[18:22:48] [Chromedriver Install] Downloading https://chromedriver.storage.googleapis.com/2.44/chromedriver_mac64.zip...
[18:22:52] [Chromedriver Install] Writing binary content to /var/folders/ng/_2f_j78n1vg4gf8xnxvx9c780000gn/T/2019025-62054-1018qcf.8dtn/chromedriver_mac64.zip...
[18:22:52] [Chromedriver Install] Extracting /var/folders/ng/_2f_j78n1vg4gf8xnxvx9c780000gn/T/2019025-62054-1018qcf.8dtn/chromedriver_mac64.zip to /var/folders/ng/_2f_j78n1vg4gf8xnxvx9c780000gn/T/2019025-62054-1018qcf.8dtn/chromedriver_mac64
[18:22:52] [Chromedriver Install] Creating /Users/infotmt/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver/mac...
[18:22:52] [Chromedriver Install] Copying unzipped binary, reading from /var/folders/ng/_2f_j78n1vg4gf8xnxvx9c780000gn/T/2019025-62054-1018qcf.8dtn/chromedriver_mac64/chromedriver...
[18:22:52] [Chromedriver Install] Writing to /Users/infotmt/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver/mac/chromedriver...
[18:22:52] [Chromedriver Install] /Users/infotmt/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver/mac/chromedriver successfully put in place
> appium-selendroid-driver#1.13.2 install /Users/infotmt/lib/node_modules/appium/node_modules/appium-selendroid-driver
> node ./bin/install.js
[18:22:54] Java version 1.8.0_202 found
[18:22:55] Ensuring /Users/infotmt/lib/node_modules/appium/node_modules/appium-selendroid-driver/selendroid/download exists
[18:22:55] Downloading Selendroid standalone server version 0.17.0 from https://repo1.maven.org/maven2/io/selendroid/selendroid-standalone/0.17.0/selendroid-standalone-0.17.0-with-dependencies.jar --> /Users/infotmt/lib/node_modules/appium/node_modules/appium-selendroid-driver/selendroid/download/selendroid-server-7cf7163ac47f1c46eff95b62f78b58c1dabdec534acc6632da3784739f6e9d82.jar
[18:23:07] Writing binary content to /Users/infotmt/lib/node_modules/appium/node_modules/appium-selendroid-driver/selendroid/download/selendroid-server.jar.tmp
[18:23:07] Selendroid standalone server downloaded
[18:23:07] Determining AndroidManifest location
[18:23:07] Determining server apk location
[18:23:07] Extracting manifest and apk to /Users/infotmt/lib/node_modules/appium/node_modules/appium-selendroid-driver/selendroid/download
[18:23:07] Copying manifest and apk to /Users/infotmt/lib/node_modules/appium/node_modules/appium-selendroid-driver/selendroid
[18:23:07] Cleaning up temp files
[18:23:07] Fixing AndroidManifest icon bug
> appium-windows-driver#1.5.1 install /Users/infotmt/lib/node_modules/appium/node_modules/appium-windows-driver
> node install-npm.js
Not installing WinAppDriver since did not detect a Windows system
> fsevents#2.0.1 install /Users/infotmt/lib/node_modules/appium/node_modules/fsevents
> [ -f fsevents.node ] || npm run prepare
> heapdump#0.3.12 install /Users/infotmt/lib/node_modules/appium/node_modules/heapdump
> node-gyp rebuild
CXX(target) Release/obj.target/addon/src/heapdump.o
In file included from ../src/heapdump.cc:17:
../../nan/nan.h:1064:44: warning: 'ToString' is deprecated: Use maybe version
[-Wdeprecated-declarations]
v8::Local<v8::String> string = from->ToString(v8::Isolate::GetCurrent());
^
/Users/infotmt/.node-gyp/11.7.0/include/node/v8.h:2537:3: note: 'ToString' has
been explicitly marked deprecated here
V8_DEPRECATED("Use maybe version",
^
/Users/infotmt/.node-gyp/11.7.0/include/node/v8config.h:326:29: note: expanded
from macro 'V8_DEPRECATED'
declarator __attribute__((deprecated(message)))
^
1 warning generated.
SOLINK_MODULE(target) Release/addon.node
+ appium#1.10.1
added 493 packages from 406 contributors and updated 2 packages in 34.024s
My advice is as follows:
1. Do not use Homebrew to install Node.js.
The best way to do this is to use the nvm version manager. I had many conflicts with Node.js on MacOS, but nvm is a bulletproof solution.
https://yoember.com/nodejs/the-best-way-to-install-node-js/
2. It is also highly recommended to use version managers for
Ruby https://github.com/rbenv/rbenv
Python https://github.com/pyenv/pyenv
Java http://www.jenv.be/
Version managers take over Node/Ruby/Python/Java management from the system and allow you to install parallel versions and keep consistency of modules/packages/gems etc.
3. Then install the following packages:
npm install -g appium
npm install -g appium-doctor
After that you can check the list of all Appium dependencies:
appium-doctor --ios
appium-doctor --android
Follow the instructions and complete the list.
4. Never install modules/packages/gems... with sudo.
The problem is that i installed the node/npm in very old version of mac. Then i upgraded the mac version to mojave.
I solve the issue by factory resetting the mac and then updating it to latest version. After that i install node/npm and then appium. It works fine now.
Are you able to start appium server using desktop client?
https://github.com/appium/appium-desktop/releases/tag/v1.10.0
Also did you refer this https://github.com/appium/appium/issues/6738?
Check your $PATH environment variable for existence of /Users/infotmt/bin.
Try installing the desktop version from releases: https://github.com/appium/appium-desktop
Did you try to install appium-doctor?
Try running npm install -g appium-doctor as kubano tolds you. I'm currently using it in mojave, so feel free to ask me anything
try installing appium using brew brew install appium it will install the appium server on local under user
Thanks!

Installing npm globally

Is it possible to install npm globally and is this a good idea?
I installed npm with the npm install command and was able to run npm start. Then after publishing my project to github I wanted to make sure it would run if someone cloned it, so I cloned it to a different directory on my machine. I then had to run npm install again to install the dependencies. Is it necessary to do this for each project you build locally or is it better and possible to install it globally on your machine?
Thanks
Command line for install npm globally--
npm install -g <package>
For more read from here.
In general, the rule of thumb is:
If you’re installing something that you want to use in your program,
using require('whatever'), then install it locally, at the root of
your project.
If you’re installing something that you want to use in your shell, on
the command line or something, install it globally, so that its
binaries end up in your PATH environment variable.
Details you can read here.
To install a module from npm globally, you'll simply need to use the --global flag when running the install command to have the module install globally, rather than locally (to the current directory).
you can use command:
npm install <module> --globalor npm install <module> -g
note: <module> is the name of the module you want to install globally

Installing scss-lint with npm without Python

I'm trying to get gulp-scss-lint to work on my machine, but having trouble doing so.
Context
I have a feeling specific versions and environment settings may be important to my issue, so let me list my specific context:
Windows Server 2012 R2 Standard
NPM 2.14.7
Node 4.2.2
Gulp 3.9.0 installed -g
Running from Powershell 4.0
Repro
Here's a repro of my problem:
mkdir gulpscsslint and cd gulpscsslint
npm init with all default answers
npm install gulp --save-dev
npm install gulp-scss-lint --save-dev
new-item -itemtype file gulpfile.js and enter:
var gulp = require('gulp'), lint = require('gulp-scss-lint');
gulp.task('default', [], function() {
return gulp.src('*.scss').pipe(lint());
});
new-item -itemtype file styles.scss
gulp
Result:
[08:48:50] Using gulpfile ~\experiments\gulpscsslint\gulpfile.js
[08:48:50] Starting 'default'...
[08:48:50] 'default' errored after 32 ms
[08:48:50] Error in plugin 'gulp-scss-lint'
Message:
Error code 1
Error: Command failed: C:\Windows\system32\cmd.exe /s /c "scss-lint 'styles.scss' --format=JSON"
'scss-lint' is not recognized as an internal or external command,
operable program or batch file.
Expected result was obviously actual output from the linter.
So then I continued:
npm install scss-lint --save-dev
But it fails with failNoPython, with this snippet from the output:
Can not download file from https://raw.githubusercontent.com/sass/node-sass-binaries/v2.1.1/win32-x64-node-4.2/binding.node
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable
Question
Is it really a hard requirement to have Python to install this Node package? Or can it somehow be installed without installing Python?
As a footnote, now that I've fully written this question I realize this might be more something of a Github issue, but if so I might need some help (learning how to) find(ing) out what package or tool is giving me trouble (gulp-scss-lint? scss-lint? npm? node-sass or some other underlying package?).
You can manually install the package by cloning or downloading it directly from it's github repository and placing it into your targeted location.
Note:
node-gyp is a cross-platform command-line tool written in Node.js for compiling native addon modules for Node.js. Link
This package requires Python to work. Hundreds of packages, including npm and npminstall, rely on node-gyp to compile. On windows, a person can install the package windows-build-tools, which includes python, to use node-gyp.