Closed albercl closed 1 year ago
Hi @albercl - This is probably down to you having both version 1 and version 2 installed.
Can you use:
npm uninstall -g dataverse-auth
npm uninstall -g dataverse-ify
npm uninstall -g dataverse-gen
Then try again? What version does it prompt you to install?
When I installed the packages I just ran npm dataverse-ify
and npm dataverse-gen
so it's supposed to download the latests versions. This versions are:
I tryed installing dataverse-auth using npm install dataverse-auth
but is the same version that is included with dataverse-gen.
My situation right now is that I tryed installing dataverse-ify and dataverse-gen in a new project (I don't have them installed globally) and the error still appears. I detected that the error appears because it tries to import the token cache from dataverse-ify/lib/xrm-webapi/TokenCache
while the real import path is dataverse-ify/lib/webapi/TokenCache
. I also tried to change the import path of the dataverse-gen package to the correct one and then it works fine. Maybe the releases publised to npm aren't updated or aligned?
The specific line is index.ts#9 that is import { loadTokenCache } from "dataverse-ify/lib/xrm-webapi/TokenCache";
but should be import { loadTokenCache } from "dataverse-ify/lib/webapi/TokenCache";
. At least, I changed it on the compiled JS and it worked as expected.
I'm using the same versions and having the same error as @albercl .
I notice latest versions on npm are 1.x not 2.x. Is it correct @scottdurow ?
Wanted to test out dataverse-ify and npm is broken for me too.
Tried to remove globals, noticed still using something from %appdata%\npm-cache
deleted that, installed only locally, etc, etc, but always not working.
So the way I did get it to work is something like this (writing on top of my head):
mkdir dataverseify-test
cd dataverseify-test
mkdir libs
cd libs
git clone https://github.com/scottdurow/dataverse-auth.git
git clone https://github.com/scottdurow/dataverse-ify.git
git clone https://github.com/scottdurow/dataverse-gen.git
cd ..
# Will error out if no such dir created before generating types
mkdir -p src\dataverse-gen
npm init
Add workspaces to package.json
:
"workspaces": [
"libs/*"
],
npm install --save .\libs\dataverse-ify\
npm install --save-dev .\libs\dataverse-gen\
npm install --save-dev .\libs\dataverse-auth\
And then thiss stuff works and is on latest version:
npx dataverse-auth
npx dataverse-gen init
So what this does is creates a monorepo where those 3 libs are coming not from node modules, but from packages within libs
directory
Had the same issue when followed the dataverse-ify's QuickStart wiki page.
It installed the 1.x version of everything. But to fix it, you just have to edit your package.json
and add the 2.x version.
"dependencies": { "dataverse-gen": "^2.0.15", "dataverse-ify": "^2.0.7", "dataverse-auth": "^2.0.7" }
Then just run npm install
and do the authentiacation and dataverse-gen init
again.
I logged in Dataverse and generated the token, but when I try to execute
npx dataverse-gen init
I get the following error:I also tried to move this file inside the node_modules folder and then it works, but I would prefer to not to do this. When I change node_modules\dataverse-gen\lib\index.js line 19 from
const TokenCache_1 = require("dataverse-ify/lib/xrm-webapi/TokenCache");
toconst TokenCache_1 = require("dataverse-ify/lib/webapi/TokenCache");
it works fine.VERSION: 1.0.13