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

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"}

Related

"Fixing missing packages and vulnerabilities in age-viewer package when installing from GitHub"

I am trying to install the age-viewer from GitHub by following these steps:
Cloning the repository
Changing directory to age-viewer
Running "npm run setup"
However, I am encountering issues with missing packages and 34 vulnerabilities (3 moderate, 22 high, 9 critical). I have attempted to resolve this by running "npm audit fix --force", but it did not work.
I am looking for a solution to fix the missing packages and vulnerabilities in the age-viewer package that I am trying to install from GitHub.
Cloning the age-viewer repository from GitHub
Changing directory to age-viewer
Running "npm run setup"
Running "npm audit fix --force" to resolve issues with missing packages and vulnerabilities
I encountered a similar error. Here is how I solved it:
Removed node_modules directory from root, frontend and backend folders.
Removed package-lock.json from root, frontend and backend folders.
Ensured node version is in range 14.16.0 - 14.21.2 (I switched to 14.16.0 using nvm)
Cd to root dir of the AGE-Viewer
npm run setup
npm run start
Hope this helps.
This error can arise due to a different reason. You can try some of the following steps to solve this error.
Try using node version 14.16.0.
If you are using WSL then make sure that the node version for your system's parent os and WSl is the same.
I had the same issue while installing, the 1st solution mentioned above worked for me [for ubuntu 22.04].
Try to use 14.16.0 version of node.
But if you are already using this version then try these steps:
npm cache clean --force
delete node_modules folder and package-lock.json file from your age-viewer root
directory.
delete node_modules folder and package-lock.json file from the frontend folder in age-viewer directory.
delete node_modules folder and package-lock.json file from the backend folder
in age-viewer directory.
npm run setup
npm run start
It works for me like this.

npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher

I am getting this warning from github on my npm project build process...
I tried searching on the internet and also read the blog link posted by github - but I could not find the solution to it anywhere. Am I missing something ?
Warning seen
npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/
After updating your NodeJS and NPM Version run this command in CLI
npm set registry=https://registry.npmjs.org/
Save your Life, Thanks me Later :D
I can solve the issue by the way:
First Step: npm set registry=https://registry.npmjs.org/
Second Step: npm install -g https://tls-test.npmjs.com/tls-test-1.0.0.tgz
Besides updating your version of node to an active or current LTS you want to ensure your NPM registry is set to an HTTPS endpoint:
registry=https://registry.npmjs.org/
You are facing that issue because your registry is set to HTTP version which is a bit insecure so the first thing that you should do is to put it to HTTPS version by running the following command below
npm set registry=https://registry.npmjs.org/
Then, after that you have to make sure your version of npm supports TLS 1.2, you can install a test package from an HTTPS endpoint that already has TLS 1.0 and TLS 1.1 disabled: by running this command below
npm install -g https://tls-test.npmjs.com/tls-test-1.0.0.tgz
You should see the following message:
Hello! The tls-test package was successfully downloaded and installed. Congratulations! Your package manager appears to support TLS 1.2.
If you don't see the message, don't worry you can try to install the package again, hope it will work out for you
Please make sure that you have latest(or somewhat recent) version of node installed on your system
To make sure that your version of npm supports TLS 1.2, you can install a test package from an HTTPS endpoint that already has TLS 1.0 and TLS 1.1 disabled:
npm install -g https://tls-test.npmjs.com/tls-test-1.0.0.tgz
You should see the following message:
Hello! The tls-test package was successfully downloaded and installed.
Congratulations! Your package manager appears to support TLS 1.2.
If you didn't see the above message, try to install some npm package.
If you didn't see the npm notice, you're good to go. If you happened to see again, please run the below command too.
npm set registry=https://registry.npmjs.org/
Source: The npm registry is deprecating TLS 1.0 and TLS 1.1
You are facing this issue because of your registry is still set to http version and that causing you this error. All You need to do is just Run following command in your terminal.
npm config set registry https://registry.npmjs.org/
and that is it!
now you can run any npm command
Well, I had several problems with node and npm. The one described in this question was only the last one.
I was not able to execute npm install, the node_modules were partially downloaded and at the end of the execution they were all deleted (the folder was visible, but it was deleted after running the command).
First problem: --location=global
First, I was getting this error message:
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead
Which I solved by following these instructions: https://stackoverflow.com/a/72592742/7389293
Apparently that allowed me to update to:
node -v: c16.16.0
npm -v: 8.17.0
Today's date: August 13, 2022.
Second problem: use TLS 1.2 or higher
Then, I still was having the error described in this question, which didn't allowed me to install the node_modules folder in my project:
npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher
The selected answer to the question made in the present screen your reading, finally fixed the problem: https://stackoverflow.com/a/70555822/7389293
After all of this I was able to run npm again, install all the packages from the package.json file, and run the website normally in the browser.
maxtimeout didn't work for me
so I tried converting to yarn by npm I -g yarn
and then yarn install in the root directory of the project(where I have to install the node_modules)

Trying to run babel : "cannot find module #babel/core"

I'm trying to set up a build environment to explore react.
My build process uses gulp.
I installed packages like this:
npm install --save-dev gulp-babel#7 babel-core babel-preset-env
After discovering that I needed to install something related to babel and react I also ran:
npm install --save-dev #babel/preset-react
My .babelrc has this:
{ "presets": ["#babel/preset-react"] }
My gulpfile has this:
gulp.task('scripts', function() {
return gulp.src(['./src/js/main.js' ])
.pipe(babel({
presets : ['#babel/preset/react']
}))
.pipe(concat('test.js'))
.pipe(gulp.dest('./js'))
.pipe(uglify())
.pipe(rename('test.min.js'))
.pipe(gulp.dest('./js')) ;
});
When I run 'gulp scripts' I get this:
[22:51:14] Using gulpfile ~/play/learning-react-2/gulpfile.js
[22:51:14] Starting 'scripts'...
[22:51:14] 'scripts' errored after 59 ms
[22:51:14] Error in plugin "gulp-babel"
Message:
Cannot find module '#babel/core' (While processing preset: "/home/bob/play/learning-react-2/node_modules/#babel/preset-react/lib/index.js")
I deleted babel-core from node_modules, and reinstalled it using the command:
npm install --save-dev #babel/core
If I look at the contents of node_modules, I see these packages related to babel:
babel-code-frame/
babel-helper-builder-binary-assignment-operator-visitor/
babel-helper-call-delegate/
babel-helper-define-map/
babel-helper-explode-assignable-expression/
babel-helper-function-name/
babel-helper-get-function-arity/
babel-helper-hoist-variables/
babel-helper-optimise-call-expression/
babel-helper-regex/
babel-helper-remap-async-to-generator/
babel-helper-replace-supers/
babel-messages/
babel-plugin-check-es2015-constants/
babel-plugin-syntax-async-functions/
babel-plugin-syntax-exponentiation-operator/
babel-plugin-syntax-trailing-function-commas/
babel-plugin-transform-async-to-generator/
babel-plugin-transform-es2015-arrow-functions/
babel-plugin-transform-es2015-block-scoped-functions/
babel-plugin-transform-es2015-block-scoping/
babel-plugin-transform-es2015-classes/
babel-plugin-transform-es2015-computed-properties/
babel-plugin-transform-es2015-destructuring/
babel-plugin-transform-es2015-duplicate-keys/
babel-plugin-transform-es2015-for-of/
babel-plugin-transform-es2015-function-name/
babel-plugin-transform-es2015-literals/
babel-plugin-transform-es2015-modules-amd/
babel-plugin-transform-es2015-modules-commonjs/
babel-plugin-transform-es2015-modules-systemjs/
babel-plugin-transform-es2015-modules-umd/
babel-plugin-transform-es2015-object-super/
babel-plugin-transform-es2015-parameters/
babel-plugin-transform-es2015-shorthand-properties/
babel-plugin-transform-es2015-spread/
babel-plugin-transform-es2015-sticky-regex/
babel-plugin-transform-es2015-template-literals/
babel-plugin-transform-es2015-typeof-symbol/
babel-plugin-transform-es2015-unicode-regex/
babel-plugin-transform-exponentiation-operator/
babel-plugin-transform-regenerator/
babel-plugin-transform-strict-mode/
babel-preset-env/
babel-runtime/
babel-template/
babel-traverse/
babel-types/
I'm guessing that at least one of them is "babel core"
So... how do I actually run babel from gulp? How do I run it at all?
I had the same issue. I resolved it by removing node_modules and I reinstalled packages (with yarn OR npm install). The problem was fixed.
In case Victor's answer doesn't help, it may be worth a try to clean your machine's package cache by running npm cache clean/yarn cache clean or removing the cache folder manually.

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.

Ember-CLI error on changing a CSS file

I'm trying out Ember-CLI, and have encountered my first obscure problem (there were others, but… they're fixed). On trying to save a change in the app.css file, this happens:
file changed styles/app.css
EEXIST, file already exists '/Users/admin/projects/saves/tmp/caching-writer-dest-dir_fjlhTg.tmp'
Error: EEXIST, file already exists '/Users/admin/projects/saves/tmp/caching-writer-dest-dir_fjlhTg.tmp'
at Error (native)
at Object.fs.symlinkSync (fs.js:852:18)
at symlink (/Users/admin/projects/saves/node_modules/ember-cli/node_modules/symlink-or-copy/index.js:82:14)
at Function.symlinkOrCopySync (/Users/admin/projects/saves/node_modules/ember-cli/node_modules/symlink-or-copy/index.js:58:5)
at /Users/admin/projects/saves/node_modules/ember-cli/node_modules/broccoli-sourcemap-concat/node_modules/broccoli-caching-writer/index.js:103:21
at lib$rsvp$$internal$$tryCatch (/Users/admin/projects/saves/node_modules/ember-cli/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:489:16)
at lib$rsvp$$internal$$invokeCallback (/Users/admin/projects/saves/node_modules/ember-cli/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:501:17)
at lib$rsvp$$internal$$publish (/Users/admin/projects/saves/node_modules/ember-cli/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:472:11)
at lib$rsvp$asap$$flush (/Users/admin/projects/saves/node_modules/ember-cli/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:1290:9)
at process._tickCallback (node.js:355:11)
The closest match I can find is this ember-cli issue.
Update and fix:
I tried the following:
rm -rf node_modules tmp dist && npm cache clean
ember install
But the issue persisted (after also trying the add rimraf to dependencies and doing npm install rimraf, now removed again).
The actual solution
Then it occurred to me that I needed to npm update ember-cli, then the above commands again, after which all is working now :-)
Update: As per raytiley's comments, the issue is not with rimraf, and the offender (broccoli-caching-writer) should be fixed soon. Therefore, at this time, Step 1 should not be necessary if you're experiencing this problem now.
See the comments in the Github Issue
This looks like a recent issue with dependencies, specifically rimraf. Currently, users are having success with this solution:
First, add this to your package.json file: (Not needed anymore)
"dependencies": {
"rimraf": "2.2.8"
}
Secondly, type this into the command line to re-install your node items
rm -rf node_modules tmp dist && npm cache clean
ember install
Hope that helps!