Xcode yarn: command not found - ios

I received an error when I build the app on Xcode:
/bin/sh: yarn: command not found
make: *** [LocalMediaPicker/Sources/LocalMediaPicker/Generated/i18n.stamp] Error 127
Command PhaseScriptExecution failed with a nonzero exit code
But I run which yarn in terminal get /opt/homebrew/bin/yarn, not sure why the Xcode cannot find yarn
Xcode version: Version 13.4.1 (13F100)
yarn version: 1.22.17
OS: Monterey Version 12.3
Update: Tried npm i -g yarn
> yarn#1.22.19 preinstall /opt/homebrew/lib/node_modules/yarn
> :; (node ./preinstall.js > /dev/null 2>&1 || true)
npm ERR! code EEXIST
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/yarn/bin/yarn.js
npm ERR! dest /opt/homebrew/bin/yarn
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/yarn/bin/yarn.js' -> '/opt/homebrew/bin/yarn'
npm ERR! File exists: /opt/homebrew/bin/yarn
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

yarn is installed in a location that isn't in the PATH used by the build phase scripts. There's two ways I can think of to change the script so it should work.
Before calling yarn, add the path containing the executable to the PATH the script will use.
export PATH="$PATH:/opt/homebrew/bin"
yarn ...
Call yarn using the full path to the executable instead of just the name.
/opt/homebrew/bin/yarn ...

sudo npm install -g npm
then
sudo nom install -g yarn
Reboot your system this worked for me. There probably is a problem with mapping so that could be your problem.

Related

Docker Node image generates files with wrong user permissions

Problem
I'm using docker to generate my npm files. The problem is I get permissions issues when I do this. I have been using second alpine image to fix the permission issues. I want to speed up the process by generating the files with the correct permissions.
Attempt 1
Using the node user seemed to work at first as it persisted the user permissions on my device. When I tried it on a different device I got this error which I could not solve. The /local directory is where I'm mounting my npm directory. I also tried adding the group to the node user and got the same error.
Code
docker run -u "node" --rm -v $PWD:/local node:19.3.0 bash -c "cd local/mobile && npm install --legacy-peer-deps && npx ionic build && npx ionic cap copy"
Output
npm ERR! path /local/mobile/node_modules
npm ERR! errno -13 npm ERR!
Error: EACCES: permission denied, mkdir '/local/mobile/node_modules'
npm ERR! [Error: EACCES: permission denied, mkdir
'/local/mobile/node_modules']
{ npm ERR! errno: -13,
npm ERR!
code: 'EACCES', npm ERR! syscall: 'mkdir',
npm ERR! path:
'/local/mobile/node_modules' npm ERR! }
Attempt 2
I also tried using my local id and group id to run the dockerfile. I got a different error when using this technique.
Code
docker run -u "$(id -u):$(id -g)" --rm -v $PWD:/local node:19.3.0 bash -c "cd local/mobile && npm install --legacy-peer-deps && npx ionic build && npx ionic cap copy"
Output
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /.npm npm
ERR! errno -13
You can try specifying the user node. By default, the user "node" haven not have written permission the host machine
You try the following method
docker run --rm -v $PWD:/local node:19.3.0 bash -c "cd local/mobile && npm install --legacy-peer-deps && npx ionic build && npx ionic cap copy"

How do I install a node module in a Cypress Docker container?

In the path ~/cypress-dockerfile I have the following Dockerfile:
FROM cypress/base:10
RUN npm install --save-dev cypress
WORKDIR /node_modules
RUN npm install sqlite3
RUN $(npm bin)/cypress verify
RUN $(npm bin)/cypress run
I then run docker build . but it stops with the following:
Step 4/6 : RUN npm install sqlite3
---> Running in 13de6b7a4fcf
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
> sqlite3#5.0.0 install /node_modules/sqlite3
> node-pre-gyp install --fallback-to-build
sh: 1: node-pre-gyp: not found
npm WARN enoent ENOENT: no such file or directory, open '/package.json'
npm WARN !invalid#1 No description
npm WARN !invalid#1 No repository field.
npm WARN !invalid#1 No README data
npm WARN !invalid#1 No license field.
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! sqlite3#5.0.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the sqlite3#5.0.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! /root/.npm/_logs/2020-08-07T13_28_54_118Z-debug.log
The command '/bin/sh -c npm install sqlite3' returned a non-zero code: 1
I think that I may be in the wrong directory but I am not sure, any help would be appreciated.

Having trouble running a docker image 'quorra not found'

After allot of ado I was able to build my dockerimage, but when I try and run it I get the following error:
$ docker run swipeimage
> uswipe-merchant#0.0.1 dev /var/app
> NODE_ENV=development quorra ride --watch --env development
sh: quorra: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! uswipe-merchant#0.0.1 dev: `NODE_ENV=development quorra ride --watch --env development`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the uswipe-merchant#0.0.1 dev 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! /root/.npm/_logs/2018-12-05T10_01_14_455Z-debug.log
I tried adding RUN npm install quorrato my docker file to make sure quorra is installed but still get an error.
Finally got it, I was looking at the quorra docs, and I changed
RUN npm install quorra
to
RUN npm install -g quorra-cli
Now it works!!!
Thanks All

Unable to install appium on ubuntu 16.04 with npm

Showing below error while trying to install appium.
While doing sudo npm install -g appium.
npm ERR! Error: Invalid name: "#gulp-sourcemaps/map-sources"
npm ERR! at ensureValidName (/usr/lib/nodejs/normalize-package-data/lib/fixer.js:284:15)
npm ERR! at Object.module.exports.fixNameField (/usr/lib/nodejs/normalize-package-data/lib/fixer.js:199:5)
npm ERR! at /usr/lib/nodejs/normalize-package-data/lib/normalize.js:29:38
npm ERR! at Array.forEach (native)
npm ERR! at normalize (/usr/lib/nodejs/normalize-package-data/lib/normalize.js:28:15)
npm ERR! at final (/usr/lib/nodejs/read-package-json/read-json.js:310:33)
npm ERR! at then (/usr/lib/nodejs/read-package-json/read-json.js:124:33)
npm ERR! at /usr/lib/nodejs/read-package-json/read-json.js:234:40
npm ERR! at fs.js:268:14
npm ERR! at /usr/lib/nodejs/graceful-fs/graceful-fs.js:103:5
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Linux 3.13.0-137-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "appium"
npm ERR! cwd /home/mosheko
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/mosheko/npm-debug.log
npm ERR! not ok code 0
It might be helpful. Steps to get appium working on ubuntu pc:
Install ruby: Paste the below command at terminal and hit enter
sudo apt-get install build-essential curl git m4 ruby texinfo libbz2-dev libcurl4-openssl-dev libexpat-dev libncurses-dev zlib1g-dev
Install linux brew:
Paste the below command at terminal and hit enter
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"
set path for brew: Type: gedit .bashrc at terminal and copy paste the following into the .bashrc file
export PATH="$HOME/.linuxbrew/bin:$PATH"
export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
Install node: Paste the below commands one by one at terminal and hit enter
brew update
brew install node
brew link node
Install Appium:
npm install -g appium npm install wd
To start Appium: Paste the below command at terminal and hit enter
appium
Thanks
Install Java and check the Java version
Step 1 : Java -version
Install Node.js and npm from the Ubuntu repository.
Step 2 : sudo apt update
Step 3 : sudo apt install nodejs
Step 4 : nodejs --version
Out Put : v8.10.0 (version of the Node)
Step 5 : sudo apt install npm
Step 6 : npm --version (npm version).
Step 7 : 3.5.2
Step 8 : sudo npm install -g appium
Step 9 : npm install wd
Step 10 : npm install -g appium-doctor
To verify “Appium” installation we can use appium-doctor. For this, we have to install appium doctor using npm.
Step 11 : appium-doctor
Step 12 : Type “appium” into the terminal and press enter button.
Appium will start.

Installing ios-sim 1.9.0 fails at preinstall during rake build

My ios-sim broke recently after installing system updates, and I'm trying to re-install it. Currently, it's not installed in my directory. When running sudo npm install -g ios-sim, I receive this error.
$ sudo npm install -g ios-sim
npm http GET https://registry.npmjs.org/ios-sim
npm http 304 https://registry.npmjs.org/ios-sim
> ios-sim#1.9.0 preinstall /usr/local/lib/node_modules/ios-sim
> rake build
events.js:72
throw er; // Unhandled 'error' event
^
Error: Cannot find module './ios-sim' from '/usr/local/lib/node_modules/ios-sim'
at /usr/local/lib/node_modules/rake/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:36:25
at load (/usr/local/lib/node_modules/rake/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:54:43)
at /usr/local/lib/node_modules/rake/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:60:22
at /usr/local/lib/node_modules/rake/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:16:47
at Object.oncomplete (fs.js:107:15)
npm ERR! ios-sim#1.9.0 preinstall: `rake build`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the ios-sim#1.9.0 preinstall script.
npm ERR! This is most likely a problem with the ios-sim package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! rake build
npm ERR! You can get their info via:
npm ERR! npm owner ls ios-sim
npm ERR! There is likely additional logging output above.
I've updated Node.JS to 1.4.3.
Does anyone know why this is happening and how I can fix it?
on my system install using node.js(v0.10.8)
$ sudo npm install -g ios-sim
also failed..
however
$ git clone git://github.com/phonegap/ios-sim.git
$ cd ios-sim
$ sudo rake install prefix=/usr/local
worked fine..
You just need to set your developer active directory:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
Then you can install ios-sim as you would normally do: npm install ios-sim -g.
Check your version of Xcode, report it. Do you have Xcode Command-line tools installed also?
If you are on Mavericks:
$ xcode-select --install

Resources