Meteor require unpublished npm module - meteor

In node, it's easy to do
"dependencies": {
"express": "^4.13.3",
"node-uuid": "^1.4.3",
"PACKAGE_NAME": "git://github.com/USERNAME/REPO_NAME.git#COMMIT_SHA"
}
In meteor I can include an npm module using var uuid = Meteor.npmRequire('node-uuid'); for npm packages that are published, but when pointing my package at github (the same way I would in a node project) I get an error.
How does one doe this with Meteor? When trying to do the same thing in the package.json I get the following error
"must declare exact version of dependency:"
Any help on how to include a package that's not published to Npm?

You need to specify the commit and point to the archive. From https://atmospherejs.com/meteorhacks/npm:
If you need to install an npm module from a specific commit, use the
syntax:
{ "googleapis": "https://github.com/bradvogel/google-api-nodejs-client/archive/d945dabf416d58177b0c14da64e0d6038f0cc47b.tar.gz" }

Related

#parcel/core: Failed to resolve 'process' from './node_modules/#firebase/firestore/dist/index.esm2017.js'

I'm working on a project and when I try to run parcel dev or build command it outputs the following error:
× Build failed.
#parcel/core: Failed to resolve 'process' from './node_modules/#firebase/firestore/dist/index.esm2017.js'
D:\Workspace\Front-End\Apps\RISC-Aswan\node_modules\#firebase\firestore\dist\index.esm2017.js:5741:38
5740 | return t.store(e);
> 5741 | }
> | ^
5742 | // visible for testing
5743 | /** Parse User Agent to determine iOS version. Returns -1 if not found. */
It was working before and now I don't know the cause of the problem. I tried to delete node__modules folder and run npm install but nothing changes.
I have the following imports in the script file:
import { initializeApp } from 'firebase/app';
import { getFirestore, collection, addDoc } from 'firebase/firestore';
the second line importing the firestore is what causing the problem, commenting it leads to everthing works fine.
Here's a photo with the terminal message and the esm2017.js file
My package.json dependecies:
"devDependencies": {
"autoprefixer": "^10.4.2",
"parcel": "^2.2.1",
"postcss": "^8.4.6",
"tailwindcss": "^3.0.18"
},
"dependencies": {
"firebase": "^9.6.6",
"vanilla-hamburger": "^0.2.3"
}
for some reason modifying alias to the following worked in dev and build
"alias": {
"process": {
"global": "{}"
}
}
Here's the other suggested workaround i tried mentioned in this issue
used alias in my package.json file
"alias": {
"process": "false"
}
manually installed process package
"dependencies": {
"process": "^0.11.10",
},
updated node to v16.14.0 instead of v16.13.1.
used parcel build ./src/index.html and removed "source": "./src/index.html" in the package.json
In your package.json you are defining parcel to be the higher version compatible with 2.2.1:
"devDependencies": {
"autoprefixer": "^10.4.2",
"parcel": "^2.2.1"
// Rest of packages
Currently there is an issue in the GitHub repository for parcel regarding this problem with Firebase. While that issue shows your exact error message, the general issue to keep track of is this open issue, since this problem affects libraries other than Firebase. Something you could do is to avoid using an affected version of parcel (2.3.1 as far as I see on the issues), or keep track of the issue to update to a fixed version when it releases.
EDIT (2/23/2021):
It seems that both GitHub issues are now closed with the release of Parcel 2.3.2. I tested building a React project with Parcel and Firebase using version 2.3.1, and I encountered the exact same error as you. Updating to 2.3.2 solved the issue completely on my end without any other change of dependencies. Just in case anyone comes across this thread later on.
I was using yarn on netlify and had to do this to fix:
echo 'nodeLinker: node-modules' >> /opt/build/repo/.yarnrc.yml

error using moment.js with serverless-bundle

how can I add moment.js locale file to serverless bundle?
Thanks for any help :)
I tried the following:
git clone git#github.com:AnomalyInnovations/serverless-nodejs-starter.git
cd serverless-nodejs-starter
npm i moment
then in file handler.js add
import moment from "moment";
and update hello with just call to moment(); (to avoid lint error)
when running local run:
serverless invoke local --function hello
the error received:
Error: Cannot find module './locale'
There seems to be an issue with the latest version of momentjs as you can see in this Github Issue. You can try the following:
npm install --save moment#2.24.0
Add a resolutions block in your package.json file as such:
"resolutions": {
"moment": "2.24.0"
}

Trouble definding NPm dependancies inside local package

I am trying to create a package, but I cannot require npm modules inside the package. This results in a
Cannot find module '..path../crypto'
/packages/s3policy/lib/s3policy.js
crypto = Npm.require('crypto');
S3Policy = {};
S3Policy.readPolicy...
/packages/s3policy/package.js
Npm.depends({
'crypto': '0.0.3'
});
Package.describe({
name: 's3policy',
summary: 'S3 policy API',
version: '0.0.1'
});
Package.on_use(function (api) {
api.add_files('lib/s3policy.js', ['server']);
api.export('S3Policy');
});
Any idea as to why I am unable to require the crypto module?
Maybe this helps?
crypto is a built in node package (http://nodejs.org/api/crypto.html). It doesn't need to be installed. However, the npm crypto package is 2 year old unmaintained code that is often downloaded by mistake (https://www.npmjs.org/package/crypto). Either Meteor or NPM gets confused because the packages have the same name, but it doesn't really matter because you don't want the NPM package.
Just take crypto out of your npm packages and you should be fine.

How to get individual ui-utility module using bower.json

I'm trying to include the ui-mask utility in my projects bower.json file so other devs will be able to install it when running bower install.
I can install it manually with bower install angular-ui-utils#bower-mask,
but in my bower.json file I can't figure out the correct name/version. Should be mask-0.1.1
Angular UI-Utils
UI-Util Mask Module
What I want to work in bower.json:
{
"name": "project-name",
"dependencies": {
"jquery": "^2.1.x",
"angular": "~1.3.x",
"angular-route": "~1.3.x",
"angular-touch": "~1.3.x",
"angular-sanitize": "~1.3.x",
"at-table": "1.0.1",
"ngDialog": "0.2.13",
"angular-local-storage" : "0.0.7",
"angular-ui-utils#bower-mask" : "0.1.1" <- This should work
}
}
When using bower install angular-ui-utils#bower-mask you instruct bower to look for angular-ui-utils with a "bower-mask" version.
A version in this case is actually a git tag, branch or commit hash (when bower is using a git resolver).
Since the the angular-ui/ui-utils repository has a bower-mask branch it will be resolved.
If you would like to resolve bower-mask 0.1.1 you will need to find the correct tag in the Github repository. In this case this should be mask-0.1.1, so what you need in bower.json is:
{
"name": "project-name",
"dependencies": {
"angular-ui-utils" : "mask-0.1.1"
}
}
In the bower output you should see:
bower resolve git://github.com/angular-ui/ui-utils.git#mask-0.1.1
bower download https://github.com/angular-ui/ui-utils/archive/mask-0.1.1.tar.gz

unable to install phpunit with composer

basically i have this composer.json file:
{
"name": "phpunit/phpunit",
"require": {
"phpunit/phpunit": "3.8.*#dev"
},
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian#phpunit.de"
}
]
}
and when I go to run "composer install" i get the following error:
Loading composer repositories with package information
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for phpunit/phpunit 3.8.*#dev -> satisfiable by phpunit/phpunit[3.8.x-dev].
- phpunit/phpunit 3.8.x-dev requires phpunit/php-code-coverage 1.3.*#dev -> no matching package found.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
I have no clue as to what that means? Thanks
Before actually answering your question:
You have called your project phpunit/phpunit and you have a require on phpunit/phpunit. That is a circular dependency. You should call your project something else.
Also, I doubt that you are "Sebastian Bergmann" so you should change the name of the author and email address in your composer file.
Ok, for you actual question, Composer by default won't install dev packages. You need to explicitly tell it to install dev packages by putting
"minimum-stability": "dev"
in your root composer.json file for your project, or change the require for PHPUnit to not use the dev package e.g.
"require": {
"phpunit/phpunit": "3.8.*"
},
Unless you are actively debugging an issue in another package, it's unlikely that you actually want to use a dev version of that package. You almost always want an actual tagged version.

Resources