npm won't create a symlink for webdriver-manager while using JHipster DevBox - selenium-webdriver

I'm trying to use JHipster with the DevBox at work, so with a proxy.
I think I have everything configured accordingly, but I still can't use JHipster properly.
I want to generate a microservice gateway with Protractor, but when I use yo jhipster or npm install, it gives me the following error:
> example-gateway#0.0.0 postinstall /home/vagrant/workspace/example/example-gateway
> webdriver-manager update
sh: 1: webdriver-manager: not found
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.0.12
npm ERR! Linux 3.13.0-88-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v4.4.5
npm ERR! npm v3.9.6
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! example-gateway#0.0.0 postinstall: `webdriver-manager update`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the example-gateway#0.0.0 postinstall script 'webdriver-manager update'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the example-gateway package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webdriver-manager update
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs example-gateway
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls example-gateway
npm ERR! There is likely additional logging output above.
And with sudo:
npm WARN lifecycle example-gateway#0.0.0~postinstall: cannot run in wd %s %s (wd=%s) example-gateway#0.0.0 webdriver-manager update /home/vagrant/workspace/example/example-gateway
However, I found webdriver-manager in the node_modules/protractor/bin directory, but npm seems to be unable to use it.
Actually, I already succeeded once in generating a microservice gateway with Protractor, but I don't know how: the error about webdriver-manager just disappeared one day. Indeed, there was several other errors (packages that didn't want to be installed), and running npm install over and over again while sometimes installing manually some packages seemed to fix them. However I'm trying to use JHipster on another computer so I need to know how to fix the webdriver-manager error.
I took a look in the node_modules folder of the completed gateway project, and discovered a webdriver-manager symlink inside .bin that wasn't in the same directory of the incomplete gateway project, so I supposed npm used it instead of the one in the node_modules/protractor/bin directory. I created one linking the two in the node_modules/.bin directory of the incomplete gateway project with ln -s ../protractor/bin/webdriver-manager webdriver-manager, and it apparently worked.
The problem is that I'm trying to make the installation and the configuration of the JHipster DevBox somehow automated, so people at work wanting to use it don't have to do it manually. If they have to remember to create a symlink each time they encounter that error, it won't be very practical.
Do you know why npm won't create that symlink himself (or sometime fails to install some packages), and how to fix it in a "clean" way?

Ok I found a solution, but I still don't know exactly why it does this and if their is a cleaner way to fix it.
http://perrymitchell.net/article/npm-symlinks-through-vagrant-windows/
I just replaced the node_modules directory by a symlink to somewhere inside the guest machine, so not in the shared folder with Windows. That way, I skip all the problems caused by Windows. The downside is I have to create the link before generating any project, and to fix that link and download again all the dependencies each time I update the DevBox, because I need to destroy the DevBox to update it.

Related

Trying to install Expo-cli, But experiencing Error Codes like NPM Install Errors Like EACCES, AND ENOEMPTY

I am new to react native and I am having an issue installing expo-cli, and I get two different errors depending on how I try to install expo-cli. If I do npm install --global expo-cli, it gives the EACCES error.
This is what the problem looks like:
npm install --global expo-cli
npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /Users/mac1/.npm-global/lib/node\_modules/expo-cli
npm ERR! dest /Users/mac1/.npm-global/lib/node\_modules/.expo-cli-sUcgOQ3i
npm ERR! errno -13
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 501:20 "/Users/mac1/.npm"npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mac1/.npm/\_logs/2021-12-28T04\_20\_03\_084Z-debug.log
When I input sudo npm install expo-cli -g --unsafe-perm, it gives an ENOEMPTYerror like this
npm ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR! path /Users/mac1/.npm-global/lib/node_modules/expo-cli
npm ERR! dest /Users/mac1/.npm-global/lib/node_modules/.expo-cli-sUcgOQ3i
npm ERR! errno -66
npm ERR! ENOTEMPTY: directory not empty, rename '/Users/mac1/.npm-global/lib/node_modules/expo-cli' -> '/Users/mac1/.npm-global/lib/node_modules/.expo-cli-sUcgOQ3i'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mac1/.npm/_logs/2021-12-29T00_39_39_814Z-debug.log
It is important to add that I have tried to other methods that might solve this problem like, yarn add global expo-cli , sudo chown, npm cache clean --force, . But nothing has worked, I'm not sure if the methods don't work, or if I'm doing the procedure wrong.
Thank You for Your Time!
Option 1: I would recommend you install node js by using the nvm(node version manager). That way you can have different versions of node js installed on your system and you can easily switch versions. Then try using an earlier node version like 14 to install expo-cli
Option 2: Debug - Go through the log file, you are going to see where the error is coming from1

sysmlink error when installing tensorflow/tfjs-node

I'm trying to install #tensorflow/tfjs-node#3.2.1 (latest).
I have follow a lot of other questions I saw regarding such problems but haven't found an answer for this specific issue.
I have installed visual studio with the requested build tools.
node 14.15.5
Tried with and without the flag.
This is the output of the install command:
$ npm install #tensorflow/tfjs-node --build-from-source
npm WARN deprecated node-pre-gyp#0.14.0: Please upgrade to #mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the #mapbox scoped package will recieve updates in the future
> #tensorflow/tfjs-node#3.2.0 install C:\Users\dark_\Desktop\projects\tfjs2\node_modules\#tensorflow\tfjs-node
> node scripts/install.js
CPU-windows-3.2.0.zip
* Downloading libtensorflow
* Building TensorFlow Node.js bindings
symlink ./lib/napi-v7 failed: null
npm WARN tfjs2#1.0.0 No description
npm WARN tfjs2#1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! #tensorflow/tfjs-node#3.2.0 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the #tensorflow/tfjs-node#3.2.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dark_\AppData\Roaming\npm-cache\_logs\2021-02-27T18_14_41_492Z-debug.log
After spening a day trying the usual suspects (node-gyp reinstall as global, windows building tools (re)install as global, parameter settings, etc) I've debugged the install script and found an error in it: after the symlink stuff, the author didn't check the "error" variable, and went straight to process.exit(1)
After I tore out my hair, I've found that the solution is on it's way:
https://github.com/tensorflow/tfjs/commit/2e745c8b6efe5ffc396a86cfc50347e629091248
It has been commited to the main branch (2021.02.26), so probably we'll see it in v3.3.0, or v3.2.x
Now the problem is, that if you just do a simple npm install #tensorflow\tfjs-node, the installer sees it as an error, and deletes the whole downloaded directory in node_modules. You COULD prevent the whole thing by:
EXECUTING npm install #tensorflow/tfjs-node --ignore-scripts
THEN correcting the error by hand in the install script (check the commit at the above link) and
RUNNING npm rebuild #tensorflow/tfjs-node --build-from-source.
I needed to restart VSCode, because it had difficulties picking up the references. But if you don't want to mess arround, go back to the v2.x branch for the time being.

create-react-app running issue even after just created it

*npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! github#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the github#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:*
or sometimes I am different kind of errors just after creating the app. which means no modifications to the default automatic generated project.
and I managed to solved it.
the issue seems to be with my Yarn. incomplete uninstall or something like that. can't solve it by just reinstalling Yarn or uninstall it again. because of that, NPM create-react-app also create bugs, which IDK how.
but the solution is amazing, I just created the project in a different folder. trust me I'm not lying , different location do works in NPM. so I believe I need to format my computer to solve this 100%.
The cause maybe due to I have installed create-react-app via NPM globally and tries to install Yarn create-react-app.
anyway, by using a different folder location, my issue was fixed completely.

npm start does not work for ract template project

Running npm start after npm init does not work due to reported missing react-script library.
It is on my Windows 10 machine; I tried uninstalling and reinstalling node but it did not help.
I can only run my project by typing
>node .\node_modules\react-scripts\bin\react-scripts.js start
otherwise if I run:
>npm start
I can see errors pasted below.
reactapptest#0.1.0 start C:(...)\reactapptest
react-scripts start
npm ERR! file bash
npm ERR! path bash
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn bash
npm ERR! reactapptest#0.1.0 start: react-scripts start
npm ERR! spawn bash ENOENT
npm ERR!
npm ERR! Failed at the reactapptest#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
It looks like something is wrong with my path but I am not sure and I do not know how to solve it.
The specific error you are getting points out that bash is not available. Now bash is a shell for Unix and Unix-like environments, it is not typically installed on Windows by default. (Though it is available for Windows as well through MinGW.)
You are working on Windows, you should not need bash with react-scripts. Try upgrading npm with npm install -g npm#latest to see if this is caused by an old and broken version of npm on your system.
EDIT: Also, you may have previously configured npm to use bash. See: how to set shell for npm run-scripts in windows and note that you are pretty much trying to do the opposite, so if you have custom configuration you might want to try removing it (also explained in the linked accepted answer).

Error when trying to make an angular application with yeoman in terminal

I'm getting errors when I type this in my terminal
yo angular
First yeoman asks me if I want to use Sass, I answered no.
Then he asked if I want to use bootstrap, answered Yes.
Then he says that there are conflicts between files and he asks if I want to overwrite these files, I answered Yes. And then I'm getting this:
I'm all done. Running bower install & npm install for you to install the required dependencies. If this fails, try running the command yourself.
invoke angular:route
invoke angular:controller:/usr/local/lib/node_modules/generator-angular/route/index.js
identical app/scripts/controllers/about.js
identical test/spec/controllers/about.js
invoke angular:view:/usr/local/lib/node_modules/generator-angular/route/index.js
identical app/views/about.html
conflict test/karma.conf.js
? Overwrite test/karma.conf.js? (Ynaxdh) npm WARN package.json charlotteerpels#0.0.0 No description
npm WARN package.json charlotteerpels#0.0.0 No repository field.
npm WARN package.json charlotteerpels#0.0.0 No README data
npm WARN package.json karma-phantomjs-launcher#0.1.4 No README data
npm WARN prefer global jshint#2.5.11 should be installed with -g
npm ERR! Darwin 14.0.0
npm ERR! argv "node" "/usr/local/bin/npm" "install"
npm ERR! node v0.10.34
npm ERR! npm v2.1.17
npm ERR! path /Users/charlotteerpels/node_modules/.bin/jshint
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! Error: EACCES, unlink '/Users/charlotteerpels/node_modules/.bin/jshint'
npm ERR! { [Error: EACCES, unlink '/Users/charlotteerpels/node_modules/.bin/jshint']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/Users/charlotteerpels/node_modules/.bin/jshint' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/charlotteerpels/npm-debug.log
/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:89
if ($._.isString(componentConfigFile.main)) {
^
TypeError: Cannot read property 'main' of undefined
at findMainFiles (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:89:39)
at /usr/local/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:151:17
at forOwn (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/node_modules/lodash/dist/lodash.js:2105:15)
at Function.forEach (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/node_modules/lodash/dist/lodash.js:3302:9)
at detectDependencies (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:33:7)
at wiredep (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/wiredep.js:65:39)
at Generator._injectDependencies (/usr/local/lib/node_modules/generator-angular/app/index.js:352:5)
at /usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/async/lib/async.js:232:13
at /usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/async/lib/async.js:113:21
at /usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/async/lib/async.js:24:16
MBPvanCharlotte:ang-news charlotteerpels$ [?] May bower anonymously report usage statistics to improve the tool over time? (Y/n) y
events.js:72
throw er; // Unhandled 'error' event
^
Error: read EIO
at errnoException (net.js:905:11)
at TTY.onread (net.js:559:19)
-bash: y: command not found
Does anyone has an idea how to fix this?
Thanks in advance!
Looks like a permissions issue. Are you the admin?
Try running with sudo:
sudo yo angular
Long-term you might want to try and see if changing ownership of your node_modules directory fixes the issue:
sudo chown -R `whoami` ~/node_modules
Link to similar permission issue with NPM
Changing the directory permissions on the bower directory in charlotteerpels/.chmod for all users to read and write, fixed it. My app was made in the wrong directory (my home directory), but there are solutions for that.
make sure you run
bower install
at least once. Bower asks a questions about reporting usage statistics the first time you run it and that will cause
yo angular
command to fail.

Resources