I tried installing yarn package using powershell. First I typed npm install -g yarn then I typed yarn install. but I got the following error - powershell

I tried opening Powershell with Administrative rights and typed
set-executionpolicy remote signed
then tried this again and I still am getting below error.
yarn install
yarn install v1.22.11
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
warning react-scripts > webpack-dev-server > sockjs > uuid#3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
[2/4] Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.yarnpkg.com/#material-ui/icons/-/icons-4.9.1.tgz: ESOCKETTIMEDOUT".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\Win8\\Documents\\Masters Software Engineering\\upstac-ui\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

This worked for me, I made a file and named it
.yarnrc
and put this inside of it
network-timeout 500000
Have a look:
https://github.com/mui/material-ui/issues/12432

Related

preventing yarn from running in wrong directory

Sometimes I run yarn (2) in the wrong directory, which can result in the download of thousands of files. Cleaning that up takes a lot of time.
Is there an easy way to prevent yarn from running in a certain directory?
I am using Windows, by the way. But an OS independent solution would be even nicer.
I found this solution:
In that directory create a subdirectory node_modules.
Remove the right to write in that subdirectory for the relevant user(s).
The result looks like this:
> yarn add cypress
yarn add v1.22.15
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
error An unexpected error occurred:
"EPERM: operation not permitted, mkdir 'C:\\...\\node_modules\\ansi-escapes'".
An nothing is downloaded into that node_modules.

Jupyter Labs: "RuntimeError: npm dependencies failed to install" When Building

I'm new to using Anaconda and recently installed jupyter labs on my computer. However, any time I try to build on my local Jupyter Labs instance I get the following error:
Code run in jupyter labs terminal:
PS C:\Users\briakeit> jupyter lab build
Output:
[LabBuildApp] JupyterLab 1.2.5
[LabBuildApp] Building in C:\Users\briakeit\AnacondaFiles\share\jupyter\lab
[LabBuildApp] Building jupyterlab assets (build:prod:minimize)
An error occured.
RuntimeError: npm dependencies failed to install
See the log file for details: C:\Users\briakeit\AppData\Local\Temp\jupyterlab-debug-0b5ejkfm.log
Log file:
[LabBuildApp] Building in C:\Users\briakeit\AnacondaFiles\share\jupyter\lab
[LabBuildApp] Yarn configuration loaded.
[LabBuildApp] Node v13.7.0
[LabBuildApp] Building jupyterlab assets (build:prod:minimize)
[LabBuildApp] > node C:\Users\briakeit\AnacondaFiles\lib\site-packages\jupyterlab\staging\yarn.js install --non-interactive
[LabBuildApp] yarn install v1.15.2
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.yarnpkg.com/#jupyterlab/application-extension/-/application-extension-1.2.1.tgz: read ECONNRESET".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\briakeit\\AnacondaFiles\\share\\jupyter\\lab\\staging\\yarn-error.log".
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 "C:\Users\briakeit\AnacondaFiles\lib\site-packages\jupyterlab\debuglog.py", line 47, in debug_logging
yield
[LabBuildApp] File "C:\Users\briakeit\AnacondaFiles\lib\site-packages\jupyterlab\labapp.py", line 98, in start
command=command, app_options=app_options)
[LabBuildApp] File "C:\Users\briakeit\AnacondaFiles\lib\site-packages\jupyterlab\commands.py", line 459, in build
command=command, clean_staging=clean_staging)
[LabBuildApp] File "C:\Users\briakeit\AnacondaFiles\lib\site-packages\jupyterlab\commands.py", line 660, in build
raise RuntimeError(msg)
[LabBuildApp] RuntimeError: npm dependencies failed to install
[LabBuildApp] Exiting application: JupyterLab
This happens anytime I try using this command (e.g. after installing anew extension). I have npm v6.4.1, nodejs v10.13.0, and yarn v1.22.0 installed in this environment according to conda. I'm running Jupyter lab 1.2.6.
Any feedback, suggestions or help would be greatly appreciated.
I believe I have found the problem. I consult for a company and I was using the computer they provided me (I'm an admin on the computer). When I followed the same steps on my personal computer, it worked with no issues.
I then switched over to a different, more open network at work and the build was able to complete without errors. Clearly there is something in the firewall or something that was preventing me from doing the build.
Not sure if you've fixed it, if not you may try the solutions below.
info There appears to be trouble with your network connection. Retrying...
This is a yarn related error that seems to suggest something wrong with your network. This can happen if the yarn was trying to connect via a proxy. You can try the following if this is the case.
npm config rm proxy
npm config rm https-proxy
It can also happen if your network is too slow. You can try increasing Yarn timeout.
yarn add <yourPackage> --network-timeout 100000
Source: https://github.com/yarnpkg/yarn/issues/4890
As indicated above this might be due to the fact that your company forces you to download everything over the proxy. Yarn (which is used to install npm) does not know your proxy details by default, so you need to create a .yarnrc file in your home directory (usually C:\Users\Username where you need to fill in your own username in windows, or simply ~/ on ubuntu).
In that file you need to specify your proxy settings as follows:
https-proxy "http://username:password#proxy.address.com:port"
strict-ssl false
Note no = sign in there and quotes around the address.
Then you'll be able to download the packages through your proxy.
I had the same issue. I have tried different versions of nodejs with different environments but couldn't solve the issue. I have checked the log files and found out that there was a problem with yarn cache so clearing the yarn cache solved my problem.
From the logs you can see:
info There appears to be trouble with your network connection.
Retrying...
I had the same issue, and disabling the firewall temporarily helped me to sort out part of the the issue, but then I finally got it with:
jupyter lab build --dev-build=False --minimize=False
I had a similar issue associated with Norton notification blocking jupyter.exe and some other programs while running 'jupyter lab build'. I resolved this issue by 'Turn off or turn on Data Protector' in Norton or disabling Auto-protect and smart-firewall each time running 'jupyter lab build'.
I faced similar issues and here are the solutions that works for me:
Installed latest version of nodejs and npm.
Manually installed latest version of yarn (download its msi installer instead of via cmd--> npm install --global yarn)
remove npm proxy via cmd:
npm config rm proxy
npm config rm https-proxy
Restarting the laptop
jupyter lab build --dev-build=False --minimize=False
Voila, it works flawlessly.

How to fix 'Unsupported platform for fsevents#1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

Testing binary
Binary is fine
npm WARN rollback Rolling back node-pre-gyp#0.12.0 failed (this is probably harmless):
EPERM: operation not permitted, lstat 'C:\Users\orca
yoon\Documents\IonicProjects\starters\epic\node_modules\fsevents\node_modules'
npm notice created a lockfile as package-lock.json. You should commit
this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.9
(node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform
for fsevents#1.2.9: wanted {"os":"darwin","arch":"any"} (current:
{"os":"win32","arch":"x64"})
added 1105 packages from 1050 contributors and audited 53269 packages in 445.94s
found 1 high severity vulnerability
run npm audit fix to fix them, or npm audit for details
First,
Run your command prompt or powershell as Administrator role. Then you'll get avoided with PERMISSION ERROR.
Second,
Ignore npm audit fix. It only suggests you to renovate all of your package.json dependencies up-to-date. You should preserve the settings clarified in package.json.
Third,
If you're working on ubuntu or OS X, you won't face this issue, I guess.
PS:
According to your reply, I'd like to think about the workaround.
Remove the local node_modules & package-lock.json
Clean npm cache by npm cache verify
Update the global npm by sudo npm i -g npm
Reinstall the local node_modules by npm i
Hope this might help.
I found a solution, this is what I did:
Open your package-lock.json.
Find node_modules/fsevents, inside this there is something called "os", I had only this:
"os": [
"darwin",
],
So my OS is windows 10 64 bits I just added my OS inside "os", the result is this:
"os": [
"darwin",
"win32"
],
then save and is solved, after doing this I could install the package I was trying to install that I couldn't.
As I got into the issue just today I read the first solution but tried one thing first
Remove package-lock.json and node_modules dir first
Run these commands and it should work.
rm -rf node_modules package-lock.json
npm install
worked like a charm maybe it'll help someone else.
When seeing this kind of message on ionic or anywhere else, do run npm audit fix and see if you can successfully follow the given advice to resolve all "high severity vulnerability" issues and contribute the resulting updated dependencies back to the given codebase.
What's happening here is that a package called chokidar is being used to "watch" filesystem directories for "events" (like files being added). chokidar is a wrapper for Linux-, Windows-, and Mac-specific filesystem-watching packages, of which fsevents is the Mac variant. So, I am pretty sure anything that uses chokidar is going to have fsevents as an optional dependency, but as others have said, this WARN message can be safely ignored, as chokidar supports all common desktop architectures.
If like me, you got this issue because of using two different package managers at the same time (E.g. yarn and npm), you can simply remove the lockfile and rerun your package manager.
rm package-lock.json
The lockfile will be regenerated the next time you run your package manager. I got this error while trying to upgrade the packages with npm upgrade. After deleting the lockfile, upgrade proceeded smoothly and the lockfile was created correctly.
This warning will appear if you added IOS as platform to your project and run npm i on Windows or Linux. As you can't build IOS packages on these systems anyway you can safely ignore this warning.
I had the same issue:
Deleted package-lock.json
npm install
viola, it worked for me
After opening the command prompt or PowerShell in the administrator mode, what helped me was following this answer here.
I ran the command:
npm i --force
and that seemed to fix the issue.
If you're seeing this error in a node Github workflow, you can update the runs-on value in node.js.yml to macos-latest and it will work. Worked for me anyways.
The critical breakthrough for me was actually simple:
yarn remove fsevents
I verified that it worked by ctrl + f in yarn.lock for 'fsevents'. Before removing it, it appeared 9 times, after removing it, only 8. So I knew it had some effect.
Extra info
After removing fsevents:
git add .
git commit -m "Removed fsevents"
git push heroku master
and it worked.
Note that I also had to run bin/webpack-dev-server to see if the assets would precompile (better to try this locally where you can quickly address any deficiencies, rather than on heroku where it will take time to build).
I fixed any missing libraries with something like yarn add '#rails/activestorage' '#rails/ujs' etc, and when the app went to heroku it worked.
You have to add win64 on package.json file
For example
{"os":"darwin,linux","arch":"any"} will replace with
{"os":"darwin,linux,win32,win64","arch":"any"}

yarn install ember-cli fails with incompatible node engine

My CircleCI builds started failing today and it looks like yarn is having trouble installing ember-cli. I tried locally and am suddenly getting the same error.
I recently upgraded to ember-cli 2.13.2, but I don't think that's related because builds were working after the upgrade.
Here's my console output:
~/code/my-app(master ✗) yarn global add ember-cli
yarn global v0.24.6
warning No license field
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
error core-object#3.1.2: The engine "node" is incompatible with this module. Expected version "=> ^4.0.0".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.
What is your Node version? I've tried installing by yarn Ember CLI 1.13 project and it failed because CoreObject required versions between 4 and 7. I've downgraded Node from 8 to 7 and it worked.
I figured out my issue. I was using a Docker image that uses the latest version of node. When node updated to 8, my Circle builds started using that. I ended up creating my own image that is pegged at version 6 and using that on Circle instead.

npm error while installing ionic dependencies

After cloning the project code from the Repository, I'm trying to install the npm to update the packages and plugins included. The command used is:
npm install
It worked well for previous clones. But now it displays the following error:
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 WARN appname# No repository field.
npm WARN appname# No license field.
When I tried to install fsevents using --verbose, it is said that the supported OS is Darwin. But it worked in the previous clone. Why not now?
If your a Windows user:
The fsevents warning isn't a problem. It's an optional dependency and isn't needed for this to work on Windows.
But the error still displaying, in order to fix this.
Open package.json and delete the gulp-watch dependecy
Manualy remove the folder (gulp-watch) from the node_modules fordel
Unload the Project and uploaded again
The error is gone!!!
There's a issue open to fix this in .net core , but this will work untill then.