Having trouble using/installing #pnp/sp modules - sharepoint-online

I'm trying to use the attachments module, specifically these features:
https://pnp.github.io/pnpjs/sp/attachments/
I've installed all pnp/sp modules necessary (I think!) using : https://pnp.github.io/pnpjs/getting-started/ as a reference.
Problem is I'm getting a 'cannot find module' for the attachments module. Below are the imports:
import { default as pnp } from 'sp-pnp-js';
import { ItemAddResult, Web } from 'sp-pnp-js';
import { sp } from "#pnp/sp"; //this is fine, which suggests it's installed properly?
import { IItem } from '#pnp/sp/attachments'; //cannot find this module
import "#pnp/sp/webs";
import "#pnp/sp/lists/web";
import "#pnp/sp/items";
import "#pnp/sp/attachments";
I've been successfully using pnp.sp features in this particular project so am stumped why I can't import and use the attachments feature.

If this is an existing project, that you've had for a bit, and you've already got #pnp in the package.json file, it may be you're using version 1 of #pnp, and you are reading the documentation for version 2.
I get the same error cannot find module when I add it to a project #pnp/sp 1.3.7
But don't get it with version 2.0.0
Version 1 document for attachments:
https://pnp.github.io/pnpjs/v1/sp/docs/attachments/
Version 2:
https://pnp.github.io/pnpjs/sp/attachments/

Related

Directory import is not supported resolving ES modules when trying import { map } from 'rxjs/operators';

I'm getting the following error when trying to import the map operator.
Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import is not supported resolving ES modules imported from
import { map } from 'rxjs/operators';
Node version: v14.15.0
It seems that ES6 modules are not yet supported
To be able to import the map module I needed to use internals as follow:
import { map } from 'rxjs/internal/operators/map.js';
Hope this might help someone.

How do I make GlideApp Compatible with androidx?

I recently migrated my app from AppCompat to Androidx but now I'm facing a serious issue with GlideApp. Whenever I try building the project, it shows compilation failed.
I tried changing the following import statements,
import android.support.annotation.CheckResult;
import android.support.annotation.NonNull;
in the build folder to:
import androidx.annotation.CheckResult;
import androidx.annotation.NonNull;
But whenever I rebuild it just regenerates the former import statement and returns the following errors:
error: package android.support.annotation does not exist error:
cannot find symbol class NonNull
I found the fix by adding annotationProcessor 'androidx.annotation:annotation:1.1.0' to my dependencies in app build.gradle and was able to build the project with no errors.
Got the solution from here: https://github.com/bumptech/glide/issues/3080#issuecomment-426331231

TypeScript - how to import 'os' module

I'm learning Typescript. To do this, I'm building a basic utility app with Node for myself. For this app, I need to use Node's OS Module. My question is, how do I import this module?
In my Typescript file, I have the following:
import { os } from 'os';
This line generates the error: "Cannot find module 'os'". What am I missing?
This line generates the error: "Cannot find module 'os'". What am I missing?
The correct code is
import os from 'os';
Also make sure you have npm i #types/node
More
Some notes I wrote on NodeJS quickstart : https://basarat.gitbook.io/typescript/docs/quick/nodejs.html
Just to update this entry:
import * as os from 'os';
and later, you can use:
const hostname = os.hostname();

Can't import an android studio 3.1.1 library

I'm trying to import this two Libraries :
import com.google.android.gms.location.ActivityRecognitionClient;
import com.google.android.gms.location.DetectedActivity;
but the .android turns to red.
this what it shows
Did i forget to add a package to my project ?
You need to add this in your gradle file :
implementation 'com.google.android.gms:play-services:12.0.1'
Check out this : Can't find the class com.google.android.gms.location.LocationClient (android)

Is there a list on how to use material-ui icons in the svg-icons folder?

I want to use the material-ui icons in the svg-icons folder I did with npm install, but the implementations of each icon on each js file have different import like the ones in the action or in the editor etc. I had to look through the js file to find how to import each icon. I want a documentation or site that specifically lets me to copy paste the import of each icon.
I was looking for **navigate next** icon from google design and found it in
import ImageNavigateNext from 'material-ui/svg-icons/image/navigate-next';
Pre v1
You can just look up the category and name on Icons.
Every SvgIcon will map to:
import MyIconName from 'material-ui/svg-icons/<category>/<name>';
For example if I want the account balance icon which is part of the action category I would import.
import BalanceIcon from 'material-ui/svg-icons/action/account-balance';
Notice that spaces will become dashes. So the list you want is on the link above.
v1
With the new version of material-ui the icons are in their own package material-ui-icons. Now you only have to lookup the name and PascalCase it to find the correct name. The category is no longer relevant. So:
import BalanceIcon from 'material-ui/svg-icons/action/account-balance';
Becomes:
import BalanceIcon from 'material-ui-icons/AccountBalance';
You can search for the icon names in your project subdirectory node_modules/#material-ui/icons.
ls node_modules/#material-ui/icons/*.js | grep -v 'Outlined' | grep -v 'Rounded' | grep -v 'Sharp' | grep -v 'TwoTone'
node_modules/#material-ui/icons/AccessAlarm.js
node_modules/#material-ui/icons/AccessAlarms.js
node_modules/#material-ui/icons/Accessibility.js
node_modules/#material-ui/icons/AccessibilityNew.js
node_modules/#material-ui/icons/AccessibleForward.js
node_modules/#material-ui/icons/Accessible.js
node_modules/#material-ui/icons/AccessTime.js
node_modules/#material-ui/icons/AccountBalance.js
node_modules/#material-ui/icons/AccountBalanceWallet.js
node_modules/#material-ui/icons/AccountBox.js
node_modules/#material-ui/icons/AccountCircle.js
node_modules/#material-ui/icons/AcUnit.js
material-ui #v1.0.0-beta.41 is deprecated and in material-ui #v1.0.0-beta.42 It does not having svg-icons module (material-ui/svg-icons)
So to use the module present in svg-icons in now we have t install material-ui-icons.
**I faced this error and after searching got to know. **
Module not found:Can't resolve 'material-ui/MenuItem'
Module not found: Can't resolve 'material-ui/svg-icons/file/file-download'
Module not found: Can't resolve 'material-ui/svg-icons/content/content-copy'
Module not found: Can't resolve 'material-ui/svg-icons/toggle/star-border'
Module not found: Can't resolve 'material-ui/svg-icons/action/delete'
Module not found: Can't resolve 'material-ui/svg-icons/image/remove-red-eye';
Example:
After installing material-ui #v1.0.0-beta.42 also install
material-ui-icons link:
material-ui-icons
npm install --save material-ui-icons
Few modules which are not present in material-ui #v1.0.0-beta.42 are
and that are present in 'material-ui-icons':
// import MenuItem from 'material-ui/MenuItem';//this was used in version material-ui #v1.0.0-beta.41
import { MenuItem } from 'material-ui/Menu';//Now in version material-ui #v1.0.0-beta.42, also need to install material-ui-icons
// import RemoveRedEye from 'material-ui/svg-icons/image/remove-red-eye';
import RemoveRedEye from 'material-ui-icons/RemoveRedEye';
import PersonAdd from 'material-ui-icons/PersonAdd';
// import ContentCopy from 'material-ui/svg-icons/content/content-copy';
import ContentCopy from 'material-ui-icons/ContentCopy';
// import Download from 'material-ui/svg-icons/file/file-download';
import FileDownload from 'material-ui-icons/FileDownload';
// import Delete from 'material-ui/svg-icons/action/delete';
import Delete from 'material-ui-icons/Delete';
// import StarBorder from 'material-ui/svg-icons/toggle/star-border';
import StarBorder from 'material-ui-icons/StarBorder';

Resources