issue with firebase functions deployment and npm - node.js

i have some deployment issues with deployment of my firebase functions, I can see that is a problem with npm, i have tried with 5 different versions of npm while running as admin but it still doesn't work, anyone got an idea og what is wrong? i have added the cmd print and the npm log
0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli '--prefix',
1 verbose cli '$RESOURCE_DIR',
1 verbose cli 'run',
1 verbose cli 'lint' ]
2 info using npm#5.6.0
3 info using node#v8.9.4
4 verbose stack Error: ENOENT: no such file or directory, open
'C:\Users\nstavsholm\Desktop\NIKLAS\Praktik\bitcoin-info-action-
master\$RESOURCE_DIR\package.json'
5 verbose cwd C:\Users\nstavsholm\Desktop\NIKLAS\Praktik\bitcoin-info-action-
master
6 verbose Windows_NT 6.3.9600
7 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "--prefix" "$RESOURCE_DIR" "run" "lint"
8 verbose node v8.9.4
9 verbose npm v5.6.0
10 error path C:\Users\nstavsholm\Desktop\NIKLAS\Praktik\bitcoin-info-action-master\$RESOURCE_DIR\package.json
11 error code ENOENT
12 error errno -4058
13 error syscall open
14 error enoent ENOENT: no such file or directory, open 'C:\Users\nstavsholm\Desktop\NIKLAS\Praktik\bitcoin-info-action-master\$RESOURCE_DIR\package.json'
15 error enoent This is related to npm not being able to find a file.
16 verbose exit [ -4058, true ]

1. Try to replace $RESOURCE_DIR with %RESOURCE_DIR% in your firebase.json file.
or
2. (This one should solve the issue without workaround)
npm install -g git://github.com/firebase/firebase-tools#master
please try this installation again in ur project folder it should solve the issue.

Ridham Tarpara's comment under the question saved me.
I had kept trying to npm install a package to the project at the folder level.
But the package.json files are in the functions folder on firebase functions projects...
...so you have to cd into the functions folder and then install.
This solved my errors!

Related

npm init doesn't work, ENOENT: no such file or directory

I install node 14(LTS) on my window10, and npm is auto install, but npm init isn't work.
I check version of them is work
C:\Users\RURU\Documents\practice\css> node -v
// 14.4
C:\Users\RURU\Documents\practice\css> npm -v
// 6
but, npm init does't work, when I want to init a package.json.
C:\Users\RURU\Documents\practice\css> npm init # neither npm init -y
Error :
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\RURU\Documents\practice\css\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\RURU\Documents\practice\css\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\RURU\AppData\Local\npm-cache\_logs\2021-07-04T14_37_28_289Z-debug.log
Error log:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'init'
1 verbose cli ]
2 info using npm#6.14.13
3 info using node#v14.17.2
4 silly package data {
4 silly package data name: 'c',
4 silly package data version: '1.0.0',
4 silly package data description: '',
4 silly package data main: 'index.js',
4 silly package data scripts: { test: 'echo "Error: no test specified" && exit 1' },
4 silly package data author: 'ru',
4 silly package data license: 'ISC'
4 silly package data }
5 info init written successfully
6 verbose stack Error: ENOENT: no such file or directory, open 'C:\Users\RURU\Documents\practice\css\package.json'
7 verbose cwd C:\Users\RURU\Documents\practice\css
8 verbose Windows_NT 10.0.19042
9 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "init"
10 verbose node v14.17.2
11 verbose npm v6.14.13
12 error code ENOENT
13 error syscall open
14 error path C:\Users\RURU\Documents\practice\css\package.json
15 error errno -4058
16 error enoent ENOENT: no such file or directory, open 'C:\Users\RURU\Documents\practice\css\package.json'
17 error enoent This is related to npm not being able to find a file.
18 verbose exit [ -4058, true ]
I dont't know how to fix it, can anyone help, please ...
my path
C:\Program Files\nodejs\;C:\Users\RURU\AppData\Roaming\npm
You can use 2 things to solve the problem :
Start the cmd in administrator mode and try again.
Run the command using --unsafe-perms i.e. npm init --unsafe-perms
I don't think 2 step will be required in most of the cases.

Error during npm start files not found

I'm new to electron and I am trying to get it up and running on my machine. I am trying to follow along with a tutorial titled 'Creating Your First Desktop App With HTML, JS and Electron'.
I set up the folder where I wanted the files to be downloaded to and extracted them to it but after running npm intall (I did the npm start) an error showed up. this log came back. Please help me understand how to properly install or give file names need to make electron run.
I am using a windows 10 x64 machine.
here is the log
0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Users\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'start' ]
2 info using npm#3.10.5
3 info using node#v4.4.7
4 verbose stack Error: ENOENT: no such file or directory, open 'c:\Users\Desktop\WestHelper\package.json'
4 verbose stack at Error (native)
5 verbose cwd c:\Users\Desktop\WestHelper
6 error Windows_NT 10.0.10586
7 error argv "C:\Program Files\nodejs\node.exe"
"C:\Users\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "start"
8 error node v4.4.7
9 error npm v3.10.5
10 error path c:\Users\Desktop\WestHelper\package.json
11 error code ENOENT
12 error errno -4058
13 error syscall open
14 error enoent ENOENT: no such file or directory, open 'c:\Users\Desktop\WestHelper\package.json'
15 error enoent ENOENT: no such file or directory, open 'c:\Users\Desktop\WestHelper\package.json'
15 error enoent This is most likely not a problem with npm itself
15 error enoent and is related to npm not being able to find a file.
16 verbose exit [ -4058, true ]
the idea behind NPM is to install packages from package.json shipped with application, so everybody can download dependencies and packages used in project. Because of this, when you run npm install, it searches current directory for file named package.json and tries to read dependency tree from it. The message you posted says, it could not find any in directory c:\Users\Desktop\WestHelper\package.json
If I've found correct tutorial, there is a section called How it’s made where the content package.json file is present.
Hope it helped, have a wonderful day.
T

Npm install doesn't work on Windows 10

i have an issue with nodejs. I'm trying to install ember.js library through the command line. When i launch "npm install" command this log appear:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'install' ]
2 info using npm#2.11.3
3 info using node#v0.12.7
4 verbose config Skipping project config: C:\Users\Antonio/.npmrc. (matches userconfig)
5 verbose readDependencies loading dependencies from C:\Users\Antonio\package.json
6 error install Couldn't read dependencies
7 verbose stack Error: ENOENT, open 'C:\Users\Antonio\package.json'
7 verbose stack at Error (native)
8 verbose cwd C:\Users\Antonio
9 error Windows_NT 6.3.9600
10 error argv "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install"
11 error node v0.12.7
12 error npm v2.11.3
13 error path C:\Users\Antonio\package.json
14 error code ENOPACKAGEJSON
15 error errno -4058
16 error package.json ENOENT, open 'C:\Users\Antonio\package.json'
16 error package.json This is most likely not a problem with npm itself.
16 error package.json npm can't find a package.json file in your current directory.
17 verbose exit [ -4058, true ]
I've visited NPM Troubleshooting but i can't found the solution (i tried the three options but nothing happen).
Just to say: there is yet a folder named "npm" in AppData/Roaming.
The correct way to install ember is:
npm install -g ember-cli
ember new my-app
npm install by itself only works if you have a package.json in the directory where you type it.
I had this same issue trying to install some node modules to a fresh installation of Sails. I found the solution in this link: https://github.com/npm/npm/issues/9676
Just removed node_modules from my root and then npm install again, then I was able to install other modules as well.

Grunt stopped working all of a sudden

Tried running Grunt build and Grunt watch on my project yesterday and I ran into the follow error:
Fatal Error: Unable to find local grunt.
I made sure the files weren't deleted. I tried reinstalling Node and Grunt. Files are there and reinstalling didn't work. I've included the debug file for reference. Does anyone know what the issue could be?
0 info it worked if it ends with ok
1 verbose cli [ 'E:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli 'E:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install' ]
2 info using npm#1.3.24
3 info using node#v0.10.25
4 verbose node symlink E:\Program Files\nodejs\\node.exe
5 error install Couldn't read dependencies
6 error package.json ENOENT, open 'D:\sites\alleywire\package.json'
6 error package.json This is most likely not a problem with npm itself.
6 error package.json npm can't find a package.json file in your current directory.
7 error System Windows_NT 6.1.7601
8 error command "E:\\Program Files\\nodejs\\\\node.exe" "E:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
9 error cwd D:\sites\alleywire
10 error node -v v0.10.25
11 error npm -v 1.3.24
12 error path D:\sites\alleywire\package.json
13 error code ENOPACKAGEJSON
14 error errno 34
15 verbose exit [ 34, true ]
You need to install grunt locally with your project (install without -g). This is not the same as grunt-cli which is the grunt command on your command line.
Run npm install inside your project folder if you have a package.json file there.

npm install doesn't work in Windows PowerShell

So my problem is this. I have a project with a package.json. When I in the command prompt (cmd.exe) run "npm install" everything installs as expected. However when I do the exact same thing in PowerShell (powershell.exe) I get an error: "npm ERR! Error: ENOENT, open 'c:\package.json'" even though I ran "npm install" in the path of the project. It always searches for package.json in c: for some reason I can't understand.
Below is the npm-debug.log (which also is written i c: even though my path is c:\code\myProject):
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install' ]
2 info using npm#1.3.11
3 info using node#v0.10.21
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 error install Couldn't read dependencies
6 error Error: ENOENT, open 'c:\package.json'
7 error If you need help, you may report this log at:
7 error <http://github.com/isaacs/npm/issues>
7 error or email it to:
7 error <npm-#googlegroups.com>
8 error System Windows_NT 6.2.9200
9 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
10 error cwd c:\
11 error node -v v0.10.21
12 error npm -v 1.3.11
13 error path c:\package.json
14 error code ENOENT
15 error errno 34
16 verbose exit [ 34, true ]
I can't find a solution to this problem anywhere. The PATH variable is setup correctly since both node and npm itself works.
For me, it was much easier to do this in Powershell.
$env:Path += ";C:\Program Files\nodejs\"
Ran "npm" in powershell, and came up straight away.
Use .npmrc to set the prefix explicitly:
Go to \Users\%USERNAME%\.npmrc. For example, in Powershell:
Notepad "\Users\$env:USERNAME\.npmrc"
Set the prefix:
prefix = "C:/Program Files/nodejs"
References
Is there a manual install of node.js for Windows 7?
Opening a program with PowerShell from a shortcut
nodeJS Modules: Loading from the Global Folders
npm config Readme
npm Folders: prefix configuration
nodejs source: legacy-npm-self-install.js
forward slash usage

Resources