How do I fix permission denied error after upgrading dependencies? - javascript

I am facing the following issue. Any help is highly appreciated.
I am upgrading one dependency in my project as per White-source advice: normalize-url, from the version 4.5.0 to 4.5.1 in order to fix security vulnerabilities.
The application runs fine and I have to test a search call which gets a 200 code and shows a response of a JSON found in "/initial-db.json".
But, After I just run npm install normalize-url#latest I can see the version in the package-lock.json is getting upgraded, but when I test my application, the search call gets a 500 code with the following error:
Error: EACCES: permission denied, open '/prod/msp/apps/src/data/initial-db.json'
at Object.openSync (fs.js:476:3)
at writeFileSync (fs.js:1467:35)
at FileSync.write (/prod/msp/apps/node_modules/lowdb/adapters/FileSync.js:53:14)
at LodashWrapper.db.write (/prod/msp/apps/node_modules/lowdb/lib/main.js:37:21)
at /prod/msp/apps/node_modules/json-server/lib/server/router/write.js:5:8
at Layer.handle [as handle_request] (/prod/msp/apps/node_modules/express/lib/router/layer.js:95:5)
at next (/prod/msp/apps/node_modules/express/lib/router/route.js:137:13)
at create (/prod/msp/apps/node_modules/json-server/lib/server/router/singular.js:37:5)
at Layer.handle [as handle_request] (/prod/msp/apps/node_modules/express/lib/router/layer.js:95:5)
at next (/prod/msp/apps/node_modules/express/lib/router/route.js:137:13)
I also tried to run npm update normalize-url --depth 7 as I saw in some suggested answers and I get the same behaviour.
I also ran npm ls normalize-url and then I updated the all the dependencies in the tree, but still with the same results.
Any idea could help. :)

Related

yarn start-https failed with error Command failed with exit code 1

I am working on a project that I downloaded, but having trouble setting up and getting the enviroment started.
After yarn install, yarn build, and then yarn start-https, I get this error message:
Error: error:0909006C:PEM routines:get_name:no start line
at node:internal/tls/secure-context:65:13
at Array.forEach (<anonymous>)
at setCerts (node:internal/tls/secure-context:63:3)
at configSecureContext (node:internal/tls/secure-context:152:5)
at Object.createSecureContext (node:_tls_common:116:3)
at Server.setSecureContext (node:_tls_wrap:1344:27)
at Server (node:_tls_wrap:1203:8)
at new Server (node:https:69:3)
at Object.createServer (node:https:105:10)
at Server.createServer (.../node_modules/webpack-dev-server/lib/Server.js:677:35)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I am have followed the set for the readMe file... and I tried googling each line of error message but nothing had helped solved this issue of exiting out.
I feel, that I must be missing something... somthing that was not documented in the readme file...
Any help would be greatly appreciated.
I think you need to check your package.json file and especially the script file
if you share more references of your start file it will grate to understand more
happy to help you
This error showing that you have a problem around ssl settings, you have to prepare self-signed SSL Certificate.

"spawn C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell ENOENT" error while running npm start

When ever I try to execute npm start, this is what happens. I think there is some issue with powershell and not with npm because npm starts the development server. BTW I created basic react app using npx create-react-app. I checked, powershell file is there in the specified location and it is working as well. Guild me what should I do in order to resolve the error.
events.js:353
throw er; // Unhandled 'error' event
^
Error: spawn C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
at onErrorNT (internal/child_process.js:467:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
at onErrorNT (internal/child_process.js:467:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell',
path: 'C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell',
spawnargs: [
'-NoProfile',
'-NonInteractive',
'–ExecutionPolicy',
'Bypass',
'-EncodedCommand',
'UwB0AGEAcgB0ACAAIgBoAHQAdABwADoALwAvAGwAbwBjAGEAbABoAG8AcwB0ADoAMwAwADAAMAAiAA=='
]
}
I faced with a same problem on Windows 10.
And solution was a pretty simple - just run your commands in git bush console.
Step 1:(reason of the error)
go to C:\Windows\System32\WindowsPowerShell\v1.0 and then you will not be found powershell.exe file that folder.
Step 2: (solution of the error)
download powershell.exe file online or just copy and paste this file in C:\Windows\System32\WindowsPowerShell\v1.0
https://www.exefiles.com/en/exe/powershell-exe/ - To download powershell.exe file online
So after trying everything and looking for the error on every possible website. I still wasn't able to resolve the error. Then I personally talked to someone regarding the error and he suggested me to run it in Windows Sub-system for Linux (WSL). I exactly did that and installed WSL with Linux 20.04 LTS. Now I am using Unix terminal to create the react app. It isn't the best solution for the problem, but yeah it does work and saves a lot of time!

npm fails on windows 10 insider preview build 14366

It seems that npm is broken (as well as the nodejs itself) on the new windows version build 1433
This is what happens when I ran
npm -v
events.js:141
throw er; // Unhandled 'error' event
^
Error: This socket is closed.
at WriteStream.Socket._writeGeneric (net.js:640:19)
at WriteStream.Socket._write (net.js:694:8)
at doWrite (_stream_writable.js:292:12)
at writeOrBuffer (_stream_writable.js:278:5)
at WriteStream.Writable.write (_stream_writable.js:207:11)
at WriteStream.Socket.write (net.js:618:40)
at WriteStream.stream.write (C:\Program Files\nodejs\node_modules\npm\node_m
at Cursor.write (C:\Program Files\nodejs\node_modules\npm\node_modules\npmlo
at Cursor.(anonymous function) [as show] (C:\Program Files\nodejs\node_modul
at Object.ProgressBar.hide (C:\Program Files\nodejs\node_modules\npm\node_mo
3.9.5
I've tried npm upgrade, but does not help much.
Are there any hotfix solutions or why this could happen?
From what I can see this is a known issue with some version of Windows 10: https://github.com/npm/npm/issues/12887. I find the proposed solution a bit weird - that the issue is presented only when you change the width of the console away from the default. You might give it a try. As it doesn't sound very plausible I am adding the github comment where I found it: https://github.com/npm/npm/issues/12887#issuecomment-222525339
Also running the command prompt in legacy mode seems to be another workaround.

Meteor reset not working in vagrant

I'm trying to get meteor reset to work in vagrant box. However I kept getting errors. This is my error message:
/home/vagrant/.meteor/packages/meteor-tool/.1.1.10.8ogiso++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/fibers/future.js:278
throw(ex);
^ Error: EBUSY, rmdir '/vagrant/foosboom-meteor/.meteor/local'
at Object.Future.wait (/home/vagrant/.meteor/packages/meteor-tool/.1.1.10.8ogiso++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/fibers/future.js:398:15)
at Object.rm_recursive (/tools/fs/files.js:270:9)
at Command.main.registerCommand.name [as func] (/tools/cli/commands.js:1211:9)
at /tools/cli/main.js:1378:23
I'm using hashicorp Otto as my development environment.
I have performed a mount on the local folder as suggested by one of the user here.
Any idea what seems to be the problem? Thanks.
After mounting you can't reset your mongo so do this
sudo umount -f /vagrant/foosboom-meteor/.meteor/local

Apache cordova ,Unable to create an app

This is the output , knowing that i'm running it under a proxy , and i specified the proxy settings.
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
then i run this command to create a new app in the specified folder "hello".
C:\>cordova create hello com.example.hello HelloWorld
Creating a new cordova project with name "HelloWorld" and id "com.example.hello"
at location "C:\hello"
Downloading cordova library for www...
this is the error :
Error: connect ETIMEDOUT
at errnoException (net.js:904:11)
at Object.afterConnect [as oncomplete] (net.js:895:19)
I recently had the same issue. I was maintaining an existing app and updating Cordova was well beyond the scope of the current task, so getting this working was really my only option.
Firstly, in order to eliminate all the errors and warnings about deprecated APIs when installing Cordova, I had to use some really ancient package managers. Using NVM I installed node 0.10.48 and npm 1.4.29. Cordova 3.6.3 then installed without any complaints.
But even creating an empty Cordova project wasn't possible as the below output shows:
Creating a new cordova project with name "HelloWorld" and id "com.example.hello" at location "~/Downloads"
Downloading cordova library for www...
Error: HTTP error 404 retrieving version 3.6.3 of cordova for www
at Request._callback (~/.nvm/v0.10.48/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/lazy_load.js:230:30)
at Request.self.callback (~/.nvm/v0.10.48/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/request/index.js:148:22)
at Request.emit (events.js:98:17)
at Request.<anonymous> (~/.nvm/v0.10.48/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/request/index.js:886:14)
at Request.emit (events.js:117:20)
at IncomingMessage.<anonymous> (~/.nvm/v0.10.48/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/request/index.js:837:12)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:944:16
at process._tickCallback (node.js:458:13)
Adding some extra debug output to lazy_load.js revealed that the CLI was looking for a directory at ~/.cordova/lib/www/cordova/3.6.3.
Since this was a brand new installation of Cordova, that directory obviously wasn't present so it went to download an archive from https://git-wip-us.apache.org/repos/asf?p=cordova-app-hello-world.git;a=snapshot;h=3.6.3;sf=tgz but the archive that used to be there has apparently been removed. I found it at https://github.com/apache/cordova-app-hello-world/releases/tag/3.6.3.
I download that archive and extracted it to ~/.cordova/lib/www/cordova/3.6.3, and I was then able to create my template app.
I know this thread is old but I really hope this helps someone. Working with Cordova is a bitch at the best of times, let alone when vital online components are removed like this.
On OSX Yosemite even with sudo the error persists.
after digging a little bit more. i found the solution.
I have just run the cmd.exe as administrator. after that worked like magic.
I ran into this problem by not installing cordova as admin. I had to sudo npm install -g cordova to get the create command to work.

Categories

Resources