NPM Error: Virtual Machine Platform Windows feature error while are already enabled - npm

Hey I am trying to install firebase in my expo cli project and I am getting the following error (while the Virtual Machine Platform Windows feature are enable):
> npm install --save firebase
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup [
npm WARN cleanup 'C:\\Users\\antri\\OneDrive\\Desktop\\gitHubThesis\\TIBaLLi-project-voice-services\\node_modules\\#grpc',
npm WARN cleanup [Error: EPERM: operation not permitted, rmdir 'C:\Users\antri\OneDrive\Desktop\gitHubThesis\TIBaLLi-project-voice-services\node_modules\#grpc\grpc-js\build\src'] {
npm WARN cleanup errno: -4048,
npm WARN cleanup code: 'EPERM',
npm WARN cleanup syscall: 'rmdir',
npm WARN cleanup path: 'C:\\Users\\antri\\OneDrive\\Desktop\\gitHubpc-js\\build\\src'npm WARN cleanup }
npm WARN cleanup ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path C:\Users\antri\OneDrive\Desktop\gitHubThesis\TIBaLLi-project-voice-services\node_modules\protobufjsnpm ERR! command failed
npm ERR! command bash -c node scripts/postinstall
npm ERR! Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS.npm ERR! For information please visit https://aka.ms/enablevirtualization
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\antri\AppData\Local\npm-cache\_logs\2023-02-19T13_07_57_559Z-debug-0.log
npm exited with non-zero code: 1
Error: npm exited with non-zero code: 1
at ChildProcess.completionListener (C:\Users\antri\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\spawn-async\src\spawnAsync.ts:65:13)
But I already have enable the virtualization in BIOS AND in my windows features as you can see in the screenshot:

Related

npm uninstall -g create-react-app Error: EPERM: operation not permitted

When creating a new react app with npx ( npx create-react-app new_app --use-npm --template typescript) I get the following error:
You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).
We no longer support global installation of Create React App.
Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app
Yet running npm uninstall -g create-react-app I get a permissions error:
npm WARN locking Error: EPERM: operation not permitted, open 'C:\Users\MYCOMP~1\AppData\Roaming\npm-cache\_locks\staging-abfecabb8ac6a958.lock'
npm WARN locking C:\Users\MYCOMP~1\AppData\Roaming\npm-cache\_locks\staging-abfecabb8ac6a958.lock failed [Error: EPERM: operation not permitted, open 'C:\Users\MYCOMP~1\AppData\Roaming\npm-cache\_locks\staging-abfecabb8ac6a958.lock'] {
npm WARN locking errno: -4048,
npm WARN locking code: 'EPERM',
npm WARN locking syscall: 'open',
npm WARN locking path: 'C:\\Users\\MYCOMP~1\\AppData\\Roaming\\npm-cache\\_locks\\staging-abfecabb8ac6a958.lock'
npm WARN locking }
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, open 'C:\Users\MYCOMP~1\AppData\Roaming\npm-cache\_locks\staging-abfecabb8ac6a958.lock'
npm ERR! [Error: EPERM: operation not permitted, open 'C:\Users\MYCOMP~1\AppData\Roaming\npm-cache\_locks\staging-abfecabb8ac6a958.lock'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path: 'C:\\Users\\MYCOMP~1\\AppData\\Roaming\\npm-cache\\_locks\\staging-abfecabb8ac6a958.lock'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
PS C:\Users\Primary User\Desktop\seisolosite\newseisolosite\CSS3DDemo> npm uninstall -g create-react-app
npm WARN locking Error: EPERM: operation not permitted, open 'C:\Users\MYCOMP~1\AppData\Roaming\npm-cache\_locks\staging-abfecabb8ac6a958.lock'
npm WARN locking C:\Users\MYCOMP~1\AppData\Roaming\npm-cache\_locks\staging-abfecabb8ac6a958.lock failed [Error: EPERM: operation not permitted, open 'C:\Users\MYCOMP~1\AppData\Roaming\npm-cache\_locks\staging-abfecabb8ac6a958.lock'] {
npm WARN locking errno: -4048,
npm WARN locking code: 'EPERM',
npm WARN locking syscall: 'open',
npm WARN locking path: 'C:\\Users\\MYCOMP~1\\AppData\\Roaming\\npm-cache\\_locks\\staging-abfecabb8ac6a958.lock'
npm WARN locking }
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path C:\Users\MYCOMP~1\AppData\Roaming\npm-cache\_locks\staging-abfecabb8ac6a958.lock
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, open 'C:\Users\MYCOMP~1\AppData\Roaming\npm-cache\_locks\staging-abfecabb8ac6a958.lock'
npm ERR! [Error: EPERM: operation not permitted, open 'C:\Users\MYCOMP~1\AppData\Roaming\npm-cache\_locks\staging-abfecabb8ac6a958.lock'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path: 'C:\\Users\\MYCOMP~1\\AppData\\Roaming\\npm-cache\\_locks\\staging-abfecabb8ac6a958.lock'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
Running yarn uninstall -g create-react-app works just fine:
yarn global v1.22.10
[1/2] Removing module create-react-app...
[2/2] Regenerating lockfile and installing missing dependencies...
info fsevents#2.3.2: The platform "win32" is incompatible with this module.
info "fsevents#2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
warning "depcheck > #vue/compiler-sfc#3.1.5" has unmet peer dependency "vue#3.1.5".
success Uninstalled packages.
Ok great, so I should be set now, right??
But then I run npx create-react-app my-app --template typescript and get the same error, we We no longer support global installation of Create React App.. Restarting the computer and running the command in a new terminal does nothing. Retrying with yarn instead of npx doesn't work either, running yarn create react-app my-app --template typescript gives error:
'C:\Users\Primary' is not recognized as an internal or external command,
operable program or batch file.
So I'm pretty much completely stuck, with neither yarn or npx working with creat-react-app. Any clues on how to get one of them working?
OS: Windows 10

How do you install Firebase tools in a Gitlab CI Runner?

I'm having some trouble configuring Gitlab CI to run firebase emulators. In particular, it's failing to install firebase-tools. This is the relevant part of my config
unit-test-job: # This job runs in the test stage.
image: node:14.14.0
artifacts:
paths:
- "test-results.xml"
reports:
junit: "test-results.xml"
stage: test
script:
- apt-get update && apt-get install -y openjdk-8-jdk
- npm i
- npm i -g firebase-tools
- firebase use $MY_PROJECT
- echo "Running unit tests..."
- npm run test:ci
When trying to install firebase-tools I get this error from the CI
$ npm i -g firebase-tools
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated 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.
npm WARN deprecated har-validator#5.1.5: this library is no longer supported
/usr/local/bin/firebase -> /usr/local/lib/node_modules/firebase-tools/lib/bin/firebase.js
> re2#1.16.0 install /usr/local/lib/node_modules/firebase-tools/node_modules/re2
> install-from-cache --artifact build/Release/re2.node --host-var RE2_DOWNLOAD_MIRROR || npm run rebuild
Trying https://github.com/uhop/node-re2/releases/download/1.16.0/linux-x64-83.br ...
Writing to build/Release/re2.node ...
Trying https://github.com/uhop/node-re2/releases/download/1.16.0/linux-x64-83.gz ...
Writing to build/Release/re2.node ...
Building locally ...
npm ERR! code EACCES
npm ERR! syscall scandir
npm ERR! path /root/.npm/_logs
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 65534:0 "/root/.npm"
glob error [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {
errno: -13,
code: 'EACCES',
syscall: 'scandir',
path: '/root/.npm/_logs'
}
> re2#1.16.0 rebuild /usr/local/lib/node_modules/firebase-tools/node_modules/re2
> node-gyp rebuild
gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/root/.cache/node-gyp/14.14.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/firebase-tools/node_modules/re2/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/firebase-tools/node_modules/re2/.node-gyp'
gyp ERR! System Linux 5.4.109+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/firebase-tools/node_modules/re2
gyp ERR! node -v v14.14.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! re2#1.16.0 rebuild: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the re2#1.16.0 rebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Any suggestions on how to fix this?
You're actually encountering an issue that isn't necessarily related to gitlab-ci, but it actually related to node 14. Essentially that /root/.npm folder has bad permissions in node 14. You have three ways you can fix this:
Update to Node 15 (just change your image to node:15) which fixes the permission issue
Allow node permissions to scan the folder. This is insinuated by the error message you have in the above error where it tells you the directory can't be scanned. The easiest way to resolve this issue is to remove the -g off the second node install, which will make it deploy to the user folder instead of global. Since you're rebuilding the container every time and using the same user each time, the -g to install globally is redundant in this case.
Install Firebase using the standalone method to get the CLI instead of using NPM to install it. You can do this in a docker container using curl -sL firebase.tools | sed 's/sudo //g' | bash
Hopefully this helps!

npm start isn't working, react-native app

im trying to build react-native app.
running the commands on gitBash, windows10.
when im trying to run 'npm start' im getting this error:
Fixed , just installed again expo-cli in the rn-starter folder, thanks for the answers :)
$ npm start
> # start C:\Users\Liran\food
> expo start
'expo-cli' is not recognized as an internal or external command,
operable program or batch file.
This command requires Expo CLI.
Do you want to install it globally [Y/n]? Y
Installing the package 'expo-cli'...
npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path C:\Users\Liran\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\.xdl.DELETE\binaries\windows\adb\AdbWinApi.dll
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\Liran\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\.xdl.DELETE\binaries\windows\adb\AdbWinApi.dll'
npm ERR! [OperationalError: EPERM: operation not permitted, unlink 'C:\Users\Liran\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\.xdl.DELETE\binaries\windows\adb\AdbWinApi.dll'] {
npm ERR! cause: [Error: EPERM: operation not permitted, unlink 'C:\Users\Liran\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\.xdl.DELETE\binaries\windows\adb\AdbWinApi.dll'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\Users\\Liran\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\node_modules\\#expo\\.xdl.DELETE\\binaries\\windows\\adb\\AdbWinApi.dll'
npm ERR! },
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\Users\\Liran\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\node_modules\\#expo\\.xdl.DELETE\\binaries\\windows\\adb\\AdbWinApi.dll',
npm ERR! parent: 'expo-cli'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Liran\AppData\Roaming\npm-cache\_logs\2020-10-19T09_36_58_255Z-debug.log
Installing Expo CLI failed. You can install it manually with:
npm install --global expo-cli
npm ERR! code ELIFECYCLE
npm ERR! errno 4294963248
npm ERR! # start: `expo start`
npm ERR! Exit status 4294963248
npm ERR!
npm ERR! Failed at the # 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:
npm ERR! C:\Users\Liran\AppData\Roaming\npm-cache\_logs\2020-10-19T09_36_58_348Z-debug.log
help please someone :)
Open windows terminal as Administrator and run command:
install --global expo-cli
then from the root of your project you can either run expo start or npm start both will do.
You need to install Expo CLI package.
see: https://docs.expo.io/workflow/expo-cli/
install:
npm install -g expo-cli
If you still getting same error do these two steps;
Be sure about working on terminal as administrator
If you're using an antivirus program, STOP it while trying to execute above command.

How do I Properly run NPM Install in Visual Studio Team Services Build Agent

I'm having trouble setting up an NPM task for an automated build in Visual Studio Team Services (previously Visual Studio Online). There are two problems:
Cache locking errors (shown below).
It is painfully slow -- 45+ minutes for a dozen or so packages.
I added the --cache argument but that did not seem to help.
npm install --dev --cache $(Agent.BuildDirectory)\b
The binaries folder seems like the right spot for the cache, but honestly, I'm not sure. Some documentation here:
https://msdn.microsoft.com/Library/vs/alm/Build/scripts/variables#AgentVariables
I appreciate any advice...
Current Config:
Build console output:
Set workingFolder to default: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.97.1\tasks\Npm\0.2.7
##[debug]check path : C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.97.1\tasks\Npm\0.2.7\task.json
##[debug]set resource file to: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.97.1\tasks\Npm\0.2.7\task.json
##[debug]system.culture=en-US
##[debug]check path : C:\Program Files\nodejs\npm.cmd
##[debug]npm=C:\Program Files\nodejs\npm.cmd
##[debug]cwd=C:\a\1\s\com.example.web
##[debug]path exists: C:\a\1\s\com.example.web
##[debug]command=install
##[debug]C:\Program Files\nodejs\npm.cmd arg: install
##[debug]arguments=--dev --cache C:\a\1\b
##[debug]C:\Program Files\nodejs\npm.cmd arg: --dev --cache C:\a\1\b
##[debug]exec tool: C:\Program Files\nodejs\npm.cmd
##[debug]Arguments:
##[debug] install
##[debug] --dev
##[debug] --cache
##[debug] C:\a\1\b
[command]C:\Program Files\nodejs\npm.cmd install --dev --cache C:\a\1\b
npm WARN deprecated graceful-fs#3.0.8: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs#^4.0.0 as soon as possible.
npm WARN deprecated sf-lint#1.0.2: Use eslint-config-simplifield instead.
npm WARN deprecated lodash#2.4.1: lodash#<3.0.0 is no longer maintained. Upgrade to lodash#^4.0.0.
npm WARN deprecated lodash#0.9.2: Grunt needs your help! See https://github.com/gruntjs/grunt/issues/1403.
npm ERR! addLocal Could not install C:\a\1\s\com.example.web\#shinnn\eslint-config#>=0.0.5 <0.0.6\fixtures
npm WARN deprecated phantomjs#2.1.3: Package renamed to phantomjs-prebuilt. Please update 'phantomjs' package references to 'phantomjs-prebuilt'
npm WARN peerDependencies The peer dependency qunitjs#^1.14.0 included from karma-qunit will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN package.json Dependency 'mocha' exists in both dependencies and devDependencies, using 'mocha#*' from dependencies
npm WARN package.json Dependency 'mocha' exists in both dependencies and devDependencies, using 'mocha#*' from dependencies
npm ERR! addLocal Could not install C:\a\1\s\com.example.web\#shinnn\eslint-config#>=0.0.4 <0.0.5\fixtures
> cson#1.6.2 preinstall C:\a\1\s\com.example.web\node_modules\gulp-uglify\node_modules\uglify-save-license\node_modules\grunt-replace\node_modules\applause\node_modules\cson
> node ./cyclic.js
npm WARN locking Error: EMFILE, open 'C:\a\1\b\_locks\strip-ansi-0bb45da2369f5768.lock.STALE.STALE.STALE'
npm WARN locking at Error (native)
npm WARN locking C:\a\1\b\_locks\strip-ansi-0bb45da2369f5768.lock failed { [Error: EMFILE, open 'C:\a\1\b\_locks\strip-ansi-0bb45da2369f5768.lock.STALE.STALE.STALE']
npm WARN locking errno: -4066,
npm WARN locking code: 'EMFILE',
npm WARN locking path: 'C:\\a\\1\\b\\_locks\\strip-ansi-0bb45da2369f5768.lock.STALE.STALE.STALE' }
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--dev" "--cache" "C:\\a\\1\\b"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
2016-03-30T14:15:17.4509244Z npm ERR! Attempt to unlock C:\a\1\s\com.example.web\node_modules\gulp-imagemin\node_modules\imagemin-pngquant\node_modules\pngquant-bin\node_modules\compare-size\node_modules\ava\node_modules\chalk\node_modules\strip-ansi, which hasn't been locked
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm WARN locking Error: EMFILE, open 'C:\a\1\b\_locks\ansi-styles-cedcc1e1e4774cd0.lock.STALE.STALE.STALE'
npm WARN locking at Error (native)
npm WARN locking C:\a\1\b\_locks\ansi-styles-cedcc1e1e4774cd0.lock failed { [Error: EMFILE, open 'C:\a\1\b\_locks\ansi-styles-cedcc1e1e4774cd0.lock.STALE.STALE.STALE']
npm WARN locking errno: -4066,
npm WARN locking code: 'EMFILE',
npm WARN locking path: 'C:\\a\\1\\b\\_locks\\ansi-styles-cedcc1e1e4774cd0.lock.STALE.STALE.STALE' }
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--dev" "--cache" "C:\\a\\1\\b"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! Attempt to unlock C:\a\1\s\com.example.web\node_modules\gulp-imagemin\node_modules\imagemin-pngquant\node_modules\pngquant-bin\node_modules\compare-size\node_modules\ava\node_modules\chalk\node_modules\ansi-styles, which hasn't been locked
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm WARN locking Error: EMFILE, open 'C:\a\1\b\_locks\has-ansi-819c7cca16ab7ac8.lock.STALE.STALE.STALE'
npm WARN locking at Error (native)
2016-03-30T14:15:17.5709240Z npm WARN locking C:\a\1\b\_locks\has-ansi-819c7cca16ab7ac8.lock failed { [Error: EMFILE, open 'C:\a\1\b\_locks\has-ansi-819c7cca16ab7ac8.lock.STALE.STALE.STALE']
Re-installing NPM solved my issue:
npm install npm -g
Specifically, I added the circled task to my build:

Error with npm install #7884 - npm WARN locking Error: EACCES

trying npm install on concat-map i get this error i already tried adding sudo
npm install concat-map
npm WARN locking Error: EACCES, open '/Users/mercadotecnia/.npm/_locks/concat-map-a127112b4f6ee84c.lock'
npm WARN locking /Users/mercadotecnia/.npm/_locks/concat-map-a127112b4f6ee84c.lock failed { [Error: EACCES, open '/Users/mercadotecnia/.npm/_locks/concat-map-a127112b4f6ee84c.lock']
npm WARN locking errno: 3,
npm WARN locking code: 'EACCES',
npm WARN locking path: '/Users/mercadotecnia/.npm/_locks/concat-map-a127112b4f6ee84c.lock' }
npm ERR! Darwin 11.4.2
npm ERR! argv "node" "/usr/local/bin/npm" "install" "concat-map"
npm ERR! node v0.10.35
npm ERR! npm v2.7.0
npm ERR! Attempt to unlock /Users/mercadotecnia/Desktop/Sitios/bill/node_modules/concat-map, which hasn't been locked
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <http://github.com/npm/npm/issues>
in terminal, do the following
$ sudo chown -R $(whoami) "$HOME/.npm"