Error: EPERM: operation not permitted errno:-1 - node.js

I wanted to make a react native app so I was following this video
https://www.youtube.com/watch?v=I2UBjN5ER4s
React Website Tutorial. I am primarily on windows I wanted my computer to accept commands just like Brian's.
So I figured out a way
https://www.youtube.com/watch?v=xzgwDbe7foQ
Using Corry's method on installing the Ubuntu app I also installed a couple of things listed below and tried running the command npx create-react-app
added 1394 packages in 5m
213 packages are looking for funding
run `npm fund` for details
node:internal/fs/utils:348
throw err;
^
Error: EPERM: operation not permitted, copyfile '/mnt/c/Users/user/Visual Studio Code Projects/website/react-website/node_modules/cra-template/template/README.md' -> '/mnt/c/Users/user/Visual Studio Code Projects/website/react-website/README.md'
at Object.copyFileSync (node:fs:2866:3)
at copyFile (/mnt/c/Users/moham/Visual Studio Code Projects/website/react-website/node_modules/fs-extra/lib/copy/copy-sync.js:73:6)
at onFile (/mnt/c/Users/moham/Visual Studio Code Projects/website/react-website/node_modules/fs-extra/lib/copy/copy-sync.js:59:25)
at getStats (/mnt/c/Users/moham/Visual Studio Code Projects/website/react-website/node_modules/fs-extra/lib/copy/copy-sync.js:51:44)
at startCopy (/mnt/c/Users/moham/Visual Studio Code Projects/website/react-website/node_modules/fs-extra/lib/copy/copy-sync.js:41:10)
at copyDirItem (/mnt/c/Users/moham/Visual Studio Code Projects/website/react-website/node_modules/fs-extra/lib/copy/copy-sync.js:125:10)
at /mnt/c/Users/moham/Visual Studio Code Projects/website/react-website/node_modules/fs-extra/lib/copy/copy-sync.js:118:39
at Array.forEach (<anonymous>)
at copyDir (/mnt/c/Users/moham/Visual Studio Code Projects/website/react-website/node_modules/fs-extra/lib/copy/copy-sync.js:118:23)
at onDir (/mnt/c/Users/moham/Visual Studio Code Projects/website/react-website/node_modules/fs-extra/lib/copy/copy-sync.js:108:10) {
errno: -1,
syscall: 'copyfile',
code: 'EPERM',
path: '/mnt/c/Users/user/Visual Studio Code Projects/website/react-website/node_modules/cra-template/template/README.md',
dest: '/mnt/c/Users/user/Visual Studio Code Projects/website/react-website/README.md'
}
Node.js v18.12.1
Aborting installation.
node has failed.
Deleting generated file... node_modules
Deleting generated file... package.json
Done.
I just wanted to execute commands just like Brian's through windows rather than purchasing a mac or etc.
I installed the js nodes and npm via command:
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - &&\
sudo apt-get install -y nodejs
which I got from here: npm show "NPM ELF : not found error" in WSL
I also wanted to upvote or commented but since I "just" joined I couldn't.
thank you for any help I am going to remove everything start from scratch in the mean time
I also installed g -g++ something along those lines in order to get the npm working I am beginner just getting started.
Again thank you for reading and helping.
(If I figured it out I will update this post whenever possible)
If this helps out anybody else in the future cheers.

Follow the mentioned steps
Use the MSI installer from the nodejs download page
Run the command mentioned below using CMD as administrator
npm install -g node-gyp
Now run the react related commands
Note: The issue is that your terminal/cmd does not have write permission, hence the error.

Related

npm install quick.db takes forever

I am trying to install quick.db, and I keep getting stuck on the line below.
I have tried npm rebuild, I have tried reinstalling node, but nothing is working. I have waited for about 3 hours.
I am using a Linux server from the free tier on Google Cloud. And I am using quick.db for a discordjs bot.
make: Entering directory '/home/user/discordbot/app/node_modules/better-sqlite3/build'
TOUCH b857c92884e9598d609f6be182a2595df7a8e00f.intermediate
ACTION deps_sqlite3_gyp_locate_sqlite3_target_extract_sqlite3 b857c92884e9598d609f6be182a2595df7a8e00f.intermediate
TOUCH Release/obj.target/deps/locate_sqlite3.stamp
CC(target) Release/obj.target/sqlite3/gen/sqlite3/sqlite3.o
It could be an issue with Google Cloud's processing because you're overloading it with npm packages. Seeing as this seems like an issue with better-sqlite3, try to uninstall all your npm packages with npm uninstall and getting rid of node_modules and package-lock.json and reload everything back in. Additionally, get rid of any packages you may not be using.
If that fails, you can try link node.js to /usr/bin/node in terminal with sudo ln -s "$(version of node you're using)" /usr/bin/node

How do I resolve the operation not permitted error while attempting to install react?

I'm running the latest version of Node.js, I have been using it for a few weeks now. So the next module in the web dev Bootcamp is to learn React.
I used the suggested command: npx create-react-app my-app
however, I got this error:
Error: EPERM: operation not permitted, mkdir 'C:\Users\JIREHGIBSON'
command not found: create-react-app
Im using a windows PC, and did not have any issues using npm until when I tried to use react locally.
I have tried to install using a sudo line command, I have edited the configuration to get rid of the space in the user name, and i have tried a force command to clear the shell cache.
Help!
You have 2 way to resolve this:
npm cache clean
Or
Did a search for .npmrc file, and changed prefix= to the correct user.
Or
npm install -g create-react-app
npx create-react-app my-app
Or
running cmd through administrator.

Contentful UI Extension Tutorial

I am trying to follow the UI Extensions Tutorial
At time code 02:36 I run the npm install && npm run login && npm run configure && npm run start command.
Afterwards I get the error: Cannot find module 'E:\Dev\Contentful\my-first-sidebar\node_modules\#contentful\contentful-extension-scripts\lib\index.js'.
I have globally re-installed the CLI and re-run the install/start command but still same error. I have also searched my hard drive for the contentful-extension-scripts\lib\ folder.
I see I have a contentful-extensions-scripts and contentful-extensions-scripts.cmd files and tried to run the cmd file but no use.
I am running on a Windows 10 box. Node version: 10.16.3​, Npm version: 6.9.0
UPDATE
I found the GitHub Repo for contentful-extensions-scripts, cloned it and copied over the folder but now I get the error: Cannot find module 'parcel-bundler' and I am out of my depth.
Add the following line to package.json to fix it:
"#contentful/contentful-extension-scripts": "^0.14.0".

node-v57-linux-x64-glibc/grpc_node.node missing when using clasp on linux

I'm using clasp to build an add-on gmail.
I created a empty folder and run this command:
clasp login
I have an error like this
Error: The gRPC binary module was not installed. This may be fixed by running "npm rebuild"
Original error: Cannot find module '/usr/lib/node_modules/#google/clasp/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc/grpc_node.node'
I found a question but it is not a solution for me.
How can i fix?
Thanks.
I had the same issue today and it seems I've found a workaround:
The following commands seem to fix the issue:
cd /usr/local/lib/node_modules/grpcc/node_modules/grpc/src
sudo npm --unsafe-perm install
Though the installation process finished with errors, the missing file was there and the grpcc was working.

Ionic, npm and cordova commands all require sudo to work

The sudo, by the looks of what I have seen in some forums, is why I am getting an error when running sudo ionic emulate ios in this post New to ionic - can’t build for ios (9) on El Capitan, and sudo ionic is required, deprecated npmconf. (I am running El Capitan btw).
Whenever I need to use an ionic, npm, or cordova command, I always have to put sudo in front of it otherwise I get a "bash command not found" error. I have tried to use this fix https://www.npmjs.com/package/npm-sudo-fix but it doesn't work. This is what happens in the log:
Dylans-MBP:Ionic Projects Dylan $ sudo npm install -g npm-sudo-fix
Password:
/usr/local/bin/npm-sudo-fix -> /usr/local/lib/node_modules/npm-sudo-fix/index.js
npm-sudo-fix#0.1.3 /usr/local/lib/node_modules/npm-sudo-fix
└── spawny#0.0.1 (cmdify#0.0.4)
Dylans-MBP:Ionic Projects Dylan$ sudo npm-sudo-fix
chown: /users/root/.npm: No such file or directory
Edit (28 August 2018):
I wrote this post and answer many years ago when I was not very familiar with the terminal. Now that I am more experienced, I can recommend the better solution. It is good practice to avoid unnecessary usages of sudo.
I believe the problem is caused by installing node JS from the installer from the node JS website. This version of node JS seems to write various files in the filesystem as root, potentially (and unnecessarily) causing global packages to require root permissions to be installed.
The ideal solution would be to completely remove node JS, that was installed from the node JS installer from the website, from your machine (see https://stackabuse.com/how-to-uninstall-node-js-from-mac-osx/). Then install node from a commandline package manager, such as homebrew.
Original Answer (2016)
Finally came up with a solution by playing with the permissions! Hopefully I didn't stuff up anything. (I am a terminal noob btw.) Anyway, here's the solution.
Run this code here in the terminal (you may or may not have to run cd .. before hand)
sudo chown -R $USER /usr/local/
This changes the permissions of every thing inside the local folder (hence the -R which means recursive). (I found this line somewhere in the ionic forums).
Now, you have to reinstall cordova and ionic
sudo npm install -g cordova
sudo npm install -g ionic
For me anyway, after I do this, I can type ionic and not get any errors. I get this in the terminal if I run cordova though.
/usr/local/lib/node_modules/cordova/node_modules/update-notifier/node_modules/configstore/index.js:53
throw err;
^
Error: EACCES: permission denied, open '/Users/Dylan/.config/configstore/update-notifier-cordova.json'
You don't have access to this file.
What I did to fix this was do this (after opening up a new terminal window):
sudo chown -R $USER Dylan
(Dylan is my user folder; replace it with yours. Also, you may have to do a cd .. before running that line And that fixes the permissions for that config file. Now running cordova works without errors! Woot! That error might come back though, so you have to run that line of code again.
Hope this helps somebody!

Resources