Cannot build app in firebase - javascript

Hello I have started work with firebase recently and stuck on one problem.
I am building small web app and I have connect this web app to firebase backend to read and write to databases.
Everything was ok and I had connection. I could put items to databases and get them by GET request. I have implemented simple authentication and that worked great too.
Suddenly today my app stops to build after 'ng serve' command in terminal window. I get an error:
ERROR in ./~/firebase/app/shared_promise.js
Module not found: Error: Can't resolve 'promise-polyfill' in '/Users/me/Desktop/GMO/node_modules/firebase/app'
# ./~/firebase/app/shared_promise.js 22:35-62
# ./~/firebase/app/firebase_app.js
# ./~/firebase/app.js
# ./~/firebase/firebase-browser.js
# ./src/app/auth/auth.service.ts
# ./src/app/app.module.ts
# ./src/main.ts
# multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts
I am sure that I didn't change anything inside firebase module.
Inside this ./~/firebase/app/shared_promise.js
there is a line there:
var PromiseImpl = scope.Promise || require('promise-polyfill');
and I have found that if I delete "|| require('promise-polyfill')" from it, the app works. Of course I don't want to do this, because this is element of module and I don't want to change it but I don't have any other idea...
Please advice!

#Andrew, your solution is working:
npm install promise-polyfill --save-exact

Related

Expo app thowing file missing error though files are actually present there

I am using pnpm to create expo app. Just created pnpm create expo-app, installed dependencies and then run yarn android === expo start --android.
Tried shamefully-hoisting as well as moving project to location with no spaces in path but each time I get the same error.
I manually checked, all the files that are shown missing in error are actually present there.
How do I fix this?
Error: Unable to resolve module ./node_modules\expo\AppEntry from C:\Users\HariC\AndroidStudioProjects\chat/.:
None of these files exist:
* node_modules\expo\AppEntry(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
* node_modules\expo\AppEntry\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
at ModuleResolver.resolveDependency (C:\Users\HariC\AndroidStudioProjects\chat\node_modules\.pnpm\metro#0.72.3\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:152:15)
at DependencyGraph.resolveDependency (C:\Users\HariC\AndroidStudioProjects\chat\node_modules\.pnpm\metro#0.72.3\node_modules\metro\src\node-haste\DependencyGraph.js:264:43)
at C:\Users\HariC\AndroidStudioProjects\chat\node_modules\.pnpm\metro#0.72.3\node_modules\metro\src\lib\transformHelpers.js:170:21
at Server._resolveRelativePath (C:\Users\HariC\AndroidStudioProjects\chat\node_modules\.pnpm\metro#0.72.3\node_modules\metro\src\Server.js:1196:12)
at async Server.requestProcessor [as _processBundleRequest] (C:\Users\HariC\AndroidStudioProjects\chat\node_modules\.pnpm\metro#0.72.3\node_modules\metro\src\Server.js:484:37)
at async Server._processRequest (C:\Users\HariC\AndroidStudioProjects\chat\node_modules\.pnpm\metro#0.72.3\node_modules\metro\src\Server.js:435:9)
Since android didn't work. I tried running web and I was prompted to install #expo/webpack-config. I installed it using expo install #expo/webpack-config#^0.17.2 and wow… It worked!

Error while creating nuxt3 project. Failed to download template from registry

When I use this command to create a new Nuxt 3 project:
npx nuxi init nuxt-app
It outputs this error:
ERROR (node:1752) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time 09:53:25
(Use `node --trace-warnings ...` to show where the warning was created)
ERROR Failed to download template from registry: fetch failed 09:53:25
at /C:/Users/myname/AppData/Local/npm-cache/_npx/a95e0f536cf9a537/node_modules/nuxi/dist/chunks/init.mjs:13269:11
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async downloadTemplate (/C:/Users/myname/AppData/Local/npm-cache/_npx/a95e0f536cf9a537/node_modules/nuxi/dist/chunks/init.mjs:13268:20)
at async Object.invoke (/C:/Users/myname/AppData/Local/npm-cache/_npx/a95e0f536cf9a537/node_modules/nuxi/dist/chunks/init.mjs:13336:15)
at async _main (/C:/Users/myname/AppData/Local/npm-cache/_npx/a95e0f536cf9a537/node_modules/nuxi/dist/cli.mjs:50:20)
My environments:
Operating System: Windows 11
node version : 18.12.0
npm version: 8.12.1
At first I suspected that this was due to my network. But I didn't get an error when I tried to install other npm packages.
I got the same issue while working at a client (bank), this is mainly a network restriction indeed. They are limiting the access to only a few NPM packages and this one is not whitelisted (mainly the template).
Not sure how to properly bypass it other than manually getting the code with an SSH/HTTP clone or maybe asking them to allow that specific endpoint.
I found the reason in here.
It's indeed a network issue. It couldn't access raw.githubusercontent.com from the command line because it couldn't find the corresponding IP address.
After adding the correct ip address of raw.githubusercontent.com to the Windows hosts file, the issue was fixed
You can also resolve it by switch your network, like if you on using a wi-fi, please change it with another.

"Error: Member not found: 'JSON'", when trying to write Firebase Cloud Functions in Dart

I already have Firebase Cloud Functions in JavaScript for an app. But I'm trying to arrange it so that I can write them in Dart, which will be automatically converted into JavaScript, following this instruction: https://pub.dev/documentation/firebase_functions_interop/latest/
When I come to the point of:
dart run build_runner build --output=build
(yes, I changed "pub" to "dart", since "pub" wasn't a defined operable or command, and "dart pub" etc was deprecated, according to the response I got... Could this be the root of the problem?),
I get this error:
Building package executable...
Failed to build build_runner:build_runner:
../../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/front_end-0.1.4+2/lib/src/fasta/crash.dart:96:45: Error: Member not found: 'JSON'.
..headers.contentType = ContentType.JSON
^^^^
and no index.dart.js file is created.
This is what my pubspec.yaml looks like:
name: functions
version: 1.0.0
environment:
sdk: '>=2.0.0-dev <3.0.0'
# sdk: '>=2.12.0 <3.0.0'
# sdk: '>=2.8.0 <3.0.0'
dependencies:
firebase_functions_interop: 1.0.0
# firebase_functions_interop: ^1.0.2
dev_dependencies:
build_runner: 1.0.0
# build_runner: ^1.9.9
# build_runner: ^2.0.3
# build_runner: ^1.9.0
build_node_compilers: 0.2.0
# build_node_compilers: ^0.3.1
I have tried to upgrade everything, but since build_node_compilers seems to be quite an abandonded package (last update was 23 months ago), I can't use the latest version of build_runner...
I've done a number of flutter clean, flutter pub get (turned out to be a bad idea, since this is a Dart project), dart pub get, dart pub upgrade, dart pub upgrade --major-versions, firebase #latest etc... but this error won't go away.
Please help! I don't know where to even start looking...

Error pushing React app to Heroku - "remote rejected main-> main (pre-reseive hook declined)"

I'm gettig this very frustrating erro while trying to push my React app to Heroku. I was able to push it up with no problem in the application's earlier development, but for some reason it now gives me the same error message all the time:
! [remote rejected] main -> main (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/sapient-origin-alpha.git'
The only thing I can think of is that there is some issue with the version of react I'm using (I tried react 18 and 17, both gave the same results). But again, I was able to push it up before with no problem so I'm not sure. My other thought was that it's the client-side package.json since it's saying the build is failing.
Another thing worth mentioning is that I re-named the Heroku app, but afterwards I removed my local git remote and created a new git remote with the updated Heroku app name. So maybe this had something to do with it? This is basically what I did:
*rename heroku app*
$ git remote rm heroku
$ heroku git:remote -a sapient-origin-alpha
If anyone is able to help me on this I would very greatly appreciate it.
Nevermind I'm just dumb. It literally told me what was wrong in the error message slightly above the text in the image I provided.
The problem was in the client-side package.json because of some dependency I was using. Make sure to double check your package.json file for things that could be causing a similar error, and delete your package-lock.json then run npm i again to refresh the file.

Illegal token in meteor/node module => cookies

I was attempting to follow along with g00glen00b's meteor/twitter walkthrough (http://g00glen00b.be/meteor-twitter-streaming/) when i got this persistent error. any help or hints would be much obliged.
things i tried
uninstall/reinstall npm
uninstall/reinstall twitter package
uninstall/reinstall cookies
searching for hidden characters
my deployed app
(htp://dbcmarch.meteor.com)
meteor error
=> Errors prevented startup:
While building the application:
node_modules/twitter/node_modules/cookies/test/express.js:1:15: Unexpected token ILLEGAL
node_modules/twitter/node_modules/cookies/test/http.js:1:15: Unexpected token ILLEGAL
express.js
#!/usr/bin/env node
var assert = require("assert"),
express = require("express"),
http.js
#!/usr/bin/env node
var assert = require("assert"),
http = require("http"),
meteor includes npm, and its perfectly acceptable to run 'mrt add npm' however npm should not be used to install its packages (e.g. npm install twitter) into a meteor project. you can require them via a packages.json file.
in order to avoid the illegal token error and get the server up running, i deleted the primary node_module dir in my project folder.
check the meteor google group for advice!

Categories