NodeJS Require cannot find module - node.js

I'm using VS 2015 for developing NodeJS console applications.
I have just created a new project from ExpressApp template.
I wanted to use 'azure-storage' packages in code.
I installed using the npm wizard VS 2015 offers and I can see the package installed in the Solution explorer under 'npm'.
Yet, I cannot require:
import azure = require('azure-storage');
Saying:
cannot find module 'azure-storage'
cannot find external module file by specified path.
You can see this in the attached picture.
Here's what I did following these two posts:
post 1 post 2
What can I do else?
thanks

It should be
var azure = require('azure-storage');

Currently, there is not an official azure sdk for typescript present. And import in typescript just can import typescript modules.
you can try to leverage the TypeScript type definitions to allow require function in typescript.
This solution leverages this answer of Importing node-modules with TypeScript on SO. Code sample should like:
///<reference path='node.d.ts'/>
var azure = require('azure-storage');
Be the way, this group has transferred azure sdk for node to typescript https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/node-azure which you can try to use directly in typescript. But the version of this sdk is a little out of date.

In new version you can defined like this.
import * as azure from 'azure-storage';

Related

How to use the 'v8' module in react native?

I am having trouble using the v8 module in my react native app (running on node version v16.14.0). I would like to use the structuredClone() function introduced in node v17. To do this I tried to access the v8 module and use the Serialization API like so (the link suggests this module should be available in node v16).
const v8 = require('v8');
// Remove in newer versions of Node that natively support structuredClone
const structuredClone = (o) => v8.deserialize(v8.serialize(o));
When I try to run this on my android phone using expo I get "Unable to resolve module v8 from C:\Users... v8 could not be found within the project or in these directories:
node_modules"
Which I think sounds like it is trying to search my project rather than the v8 module installed with node. Any ideas why this is?
EDIT: Seems this answers my question. Alternatively, it might be possible to make it usable by using this react-native-v8 package. Can't confirm as I haven't used it.

Accessing Project asset using Project_lib on cloud notebook in IBM Watson Studio

using the code:
import project_lib
project = project_lib.Project()
I tried to use the module "project_lib" in the IBM cloud Pak for data notebook but got the error:
"RuntimeError: Failed to GET project, status: 401".
The package is for accessing the assets (i.e. files) of my projects.
I tried to ask questions on IBM's website or customer services but could not find any valid solution yet. Any help will be much appreciated.
Thanks
You need to pass the parameters project_id and access_token into the Project function to make it work.
from project_lib import Project
project = Project(project_id='YOUR_PROJECT_ID', project_access_token='YOUR_PROJECT_TOKEN')

Can't reference Polly or other packages in Azure Functions

I have tried the below in a version 4 Azure Function app
#r "Polly"
using System;
using System.Threading.Tasks;
and/or
using System;
using System.Threading.Tasks;
using Polly;
But in both cases it says Polly is not found. From the docs I tried to add a framework 46 reference too in the json file for the function app but that did not work. What is the best way to import a dependency?
One of the workaround to install Polly dependency injection in Azure Functions v4 is:
Open the Azure Functions V4 Project.
Right-click on the project > Click on Manage Nuget Packages
Install the required extensions for your project like
Start writing the code related to Polly policies extension in the function class like:
The ways to add the dependency injections in the Azure Functions is:
Installing the Dependency Injections using NuGet Package Manager by right clicking on the project.
Or
Using the DotNet CLI or Package Manager commands available in the NuGet official Site.

How to work with bucklescript requires and google functions

I'm trying to deploy functions created with bucklescript to google functions but the deploy won't run without this error :
Did you list all required modules in the package.json dependencies?
Detailed stack trace: Error: Cannot find module 'bs-platform/lib/js/js_json.js'
I'm using the gcloud beta functions deploy utility. My code is using the Js.Json module, which produce var Js_json = require("bs-platform/lib/js/js_json.js"); in the outputed js code. My package.json contains the bs-platform package.
Is there a way to setup bucklescript or the gcloud utility to make my code acceptable?
BuckleScript's requires are just standard CommonJS requires, and can be bundled up into a single file using a bundler like webpack. You can also configure bsb to emit es6 modules (see the package-specs property of the bsconfig.json schema) and bundle them up using rollup.

Xamarin iOS - Firebase Analytics is not available

I have download the example project and library from this link: Xamarin Firebase but after 2 days of configuration i get this error when i launch the app:
[Firebase/Core][I-COR000022] Firebase Analytics is not available.
I did not find documentation related to this error for Xamarin iOS Firebase Analytics and can not find a solution.
I have reference the same library of the example project, checked the GoogleService-Info.plist and insert it in the project as documentation, called the App.Configure ();.
Nothing to do, does anyone have any idea?
Resolved!
Firebase Analytics requires 3 references to work:
.Core
.Analytics
.IstanceID
Following only the code in the documentation the project at start-up load only .Core skipping the other two, this causes the error.
To work around this problem, I added in AppDelegate:
using Firebase.Analytics;
using Firebase.InstanceID;
and before of App.Configure (); i have add this two line to force the app to load the two assemblies:
Firebase.Analytics.Loader loader1 = new Firebase.Analytics.Loader();
Firebase.InstanceID.Loader loader2 = new Firebase.InstanceID.Loader();
Of course, if you implement other instructions later using these two assemblies, you will not need these two instructions.

Resources