Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error #5

Closed
c437 opened this issue Sep 17, 2019 · 2 comments
Closed

Compilation error #5

c437 opened this issue Sep 17, 2019 · 2 comments

Comments

@c437
Copy link

c437 commented Sep 17, 2019

Hi,

I am getting this error while compiling my project.

Module not found: Error: Can't resolve 'readline' in './node_modules/node-sp-auth-config/node_modules/inquirer/lib/ui/baseUI.js'

I am using Create React app using this https://create-react-app.dev then followed this stackoverflow to add pnpjs to connect to my on prem sharepoint 2013 site
https://sharepoint.stackexchange.com/questions/246264/pnpjs-with-on-prem-sharepoint

It looks like pnp-auth uses node-sp-suth-config as dependecy and node-sp-suth-config as dependecy uses inquirer.js. Hovering on var readline = require('readline');, it takes me to
TypeScript\3.6\node_modules@types\node

Now, I m wondering problem in the version of typescript. Please someone help me to the resolve this issues.

My packages:

"dependencies": {
"@pnp/common": "^1.3.5",
"@pnp/graph": "^1.3.5",
"@pnp/logging": "^1.3.5",
"@pnp/nodejs": "^1.3.5",
"@pnp/odata": "^1.3.5",
"@pnp/sp": "^1.3.5",
"@types/jest": "24.0.18",
"@types/node": "12.7.4",
"@types/react": "16.9.2",
"@types/react-dom": "16.9.0",
"fetch": "^1.1.0",
"office-ui-fabric-react": "^7.31.1",
"pnp-auth": "0.0.4",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react-scripts": "3.1.1",
"typescript": "3.6"
},

node version: v8.11.1
npm version: v5.6.0

Thank you !

@s-KaiNet
Copy link
Member

Hi, sorry, but you can't use this library in a browser. It's for nodejs authentication only.

@koltyakov
Copy link
Member

@c437,

Libraries designed for Node.js (server side) can't be used client side in a browser, so pnp-auth, it can't be used in a browser, and it's not even because some dependencies use native modules, but because auth flows are not possible in browser due to browsers security limitations.

In a CRA or any other client side app located outside SPO, and which intends to consume SPO/Graph API you should authenticate via AAD application and OAuth 2 flow using ADAJ.js or MSAL.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants