Cloud functions deploy an error during a line in Windows: "enoent ENOENT: no such file or directory"

Following the start of the firebase function and getting a seemingly simple error after trying to deploy with:

firebase deploy --only functions i deploying functions Running command: npm --prefix $RESOURCE_DIR run lint npm ERR! path C:\Users\Beat\leginformant\$RESOURCE_DIR\package.json npm ERR! code ENOENT npm ERR! errno -4058 npm ERR! syscall open npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\Beat\leginformant\$RESOURCE_DIR\package.json' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent 

The package.json file exists, as the tutorial in my project /functions/package.json shows. Tried to change or print RESOURCE_DIR env without success. Assuming it will be inside an NPM shell environment.

version for npm: 5.6.0

node version: 8.9.0

+5
source share
3 answers

This is a known issue with Firebase CLI 3.17.0, at least 3.17.3, but only on Windows. You can fix this on your computer by editing firebase.json in the root of your project and replacing $RESOURCE_DIR with %RESOURCE_DIR% in the npm commands that you see there. The former is the unix syntax method for using the environment variable, while the latter is the Windows command line command line syntax. Since you are using Windows, you need to use Windows syntax.

The team is looking for ways to prevent making changes to the configuration files that you use, since platform-based commands are not very convenient for modifying the same file.

EDIT: This problem should be fixed using projects created using the CLI version 3.17.5.

+13
source

As an extra run, npm --prefix% RESOURCE_DIR% run lint, as @Deji James said, made me some progress, but still didn't work.

As a suggestion, I found this https://github.com/firebase/firebase-tools/issues/610

and @merlinnot says here Hey guys, you probably still ended up in your predeploy in firebase.json, right? Just delete what you have at the moment, if it is not so important.

worked for me. PS. before deciding to uninstall, I reinstalled everything, deleted things. Only it worked.

0
source

At startup

 firebase init functions 

I am using this configuration

 ? What language would you like to use to write Cloud Functions? JavaScript //TypeScript doesn't work ? Do you want to use ESLint to catch probable bugs and enforce style? Yes //If you don't you will get a missing file lint ? File functions/package.json already exists. Overwrite? Yes ? Do you want to install dependencies with npm now? Yes //Why not 

Then, if you use windows

Replace $ RESOURCE_DIR% RESOURCE_DIR% in firebase.json

0
source

Source: https://habr.com/ru/post/1274853/


All Articles