#Error : no such file or directory, scandir /node_modules/@dagger.io/dagger/dist/entrypoint/../../src

1 messages · Page 1 of 1 (latest)

cloud cave
#

Hey,

I'm following this tutorial to configure my project with the Typecript SDK: https://www.npmjs.com/package/typescript

I cannot use the command: dagger init --sdk=typescript
It's because I'm working in a non-Internet environment, so I can't use this command because it tries to download dependencies from the Internet.

This is a structure of my project and also, the contains of my tsconfig.json. I have specified inside this file the directory of my depencies dagger.

But when I trying the command : dagger functions I have the following error :

Error: ENOENT: no such file or directory, scandir '/src/test/tata/node_modules/@dagger.io/dagger/dist/entrypoint/../../src/'
    at Object.readdirSync (node:fs:1517:26)
    at listFiles (/src/test/tata/node_modules/@dagger.io/dagger/dist/introspector/utils/files.js:11:38)
    at entrypoint (/src/test/tata/node_modules/@dagger.io/dagger/dist/entrypoint/entrypoint.js:18:25)
    at <anonymous> (/src/test/tata/node_modules/src/__dagger.entrypoint.ts:4:1)
    at Object.<anonymous> (/src/test/tata/node_modules/src/__dagger.entrypoint.ts:4:12)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Object.h (/usr/local/lib/node_modules/tsx/dist/global-require-patch-faFw5e4x.cjs:1:1100)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at cjsLoader (node:internal/modules/esm/translators:356:17) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'scandir',
  path: '/src/test/tata/node_modules/@dagger.io/dagger/dist/entrypoint/../../src/'

Does anyone have an idea ?

Best regards.

viscid thorn
#

Hm, I'm not sure about the typescript error directly - however, dagger's not particularly well suited to a non-internet environment (at least at the moment).

#

I know we've talked a bit about offline pipelines internally before, but it's never been a priority 😢

atomic magnet
#

It's because I'm working in a non-Internet environment, so I can't use this command because it tries to download dependencies from the Internet.

If you do not have internet, I'm not sure you would be able to use the TS runtime, you can try to use the raw client, with the old method explained in https://archive.docs.dagger.io/0.9/sdk/nodejs/835948/install but you'll not benefit from the module concept

The Dagger Node.js SDK requires Node.js 16.x or later.

#

And you'll still need internet to auto-provision the engine or set the engine host to target a pre-provisioned engine that have access to internet :/

cloud cave
# atomic magnet And you'll still need internet to auto-provision the engine or set the engine ho...

Oh ok, I tried with the Python SDK and it's not a problem without internet (Normally).

It's not a problem for auto-provisioning the dagger engine because I've created a ***.tar ***of my dagger engine image on a computer with internet, same for the dagger.exe.

And after I run my engine with this command : docker run --name dagger-engine-835668aa455cbb8f --privileged --volume dagger-engine:/var/lib/dagger registry.dagger.io/engine:v0.11.4

atomic magnet
#

And after that, how are you going to perform operations with Dagger? Because every operations are executed inside container so you'll need to pull on if you want to use withExec for example?

cloud cave
#

I have my proper repository that contains image :

I use this for the connection :

How do I log in to a container registry using a Dagger SDK?
There are two options available:
Use the Container.withRegistryAuth() GraphQL API method. A native equivalent of this method is available in each Dagger SDK.
Dagger SDKs can use your existing Docker credentials without requiring separate authentication. Simply execute docker login against your container registry on the host where your Dagger pipelines are running.

atomic magnet
#

Ohhh I see, okay that's sounds like a cool setup!

cloud cave
#

no ideas ? 😭

atomic magnet
#

What's your question exactly? I think we pretty much answered? 😮

cloud cave
#

If anyone has any idea about my error that I presented before, on the link I had given, I followed all the steps and I have this error with internet or not 😅

atomic magnet
#

It's because the SDK sources should be installed in the sdk directory not in node_modules
Your TS config correct I think

#

You should have a sdk directory in your dir, but I don't see it in your screenshot

cloud cave
#

I think I'm missing something, because I have the contents of the SDK but not in the sdk directory

atomic magnet
#

Ok could you execute dagger develop? See if this generate your sdk dir

cloud cave
#

nothing generated

atomic magnet
#

Hmm that's not normal

#

Can you show me your dagger.json?

cloud cave
#

This is my dagger.json :

viscid thorn
#

Hm source should probably not be the node_modules directory

#

Not familiar with details, but that doesn't seem right based on an initial glance

atomic magnet
#

No it shouldn’t be at all, your sources should be either . Or a dagger for for example

#

Could you try to re init your project and compare the differences?

cloud cave
#

The difference is that with my tata project, I used the dagger init command, and after that, I implemented the dagger.json file with the SDK and sources.

The problem is that I can't initialize my project directly with dagger init --sdk=typescript because I don't have internet 😭

#

Sorry for the late reply

#

That's why I don’t have this structure with the file called sdk

atomic magnet
#

Yeah that makes sense, but instead of putting the SDK and sources inside nodes_modules, it should be inside a dagger dir

#

And you’ll need to manually setup the file to point to the directory SDK that contains your SDK sources

#

Try to init a ts module with internet on another environnement, so you can see the shape of a module

cloud cave
#

I don't understand something, I use commands like npm install @dagger.io/dagger --save-dev or with python virtual env pip install dagger-io which allows me to retrieve the SDK, which is normal that is not in a folder called sdk, I don't understand why I should change it place, I should just change my source no?

I feel like I'm close to the goal...

atomic magnet
#

Hmm, npm install @dagger.io/dagger is going to install the library if you want to use the client without the dagger cli.
In the case of the dagger cli, it's a bit different, the init will create a specific setup for your module, with the sdk directory but also a src directory and a prefill valid tsconfig.json, package.json

#

The thing is that Dagger module has it's own custom logic, it assumes the directory is in a certain shape, that you need to follow to make it work, here's an example

#

After dagger init --sdk=typescript --name=test

tree -L 2
.
├── LICENSE
├── dagger
│   ├── package.json # Top level pkg.json that has the sdk as local sub dependencies
│   ├── sdk # The SDK source code
│   ├── src # Your module source code
│   └── tsconfig.json # tsconfig for IDE integration
└── dagger.json
#

If you don't wanna use the module system, you can just use the dagger client

cloud cave
#

Mhhh, I think I can not using --sdk=typescript, because I don't have internet ^^'

atomic magnet
#

Yeah I know, but maybe you can do it somewhere else and copy paste the directory to your host that does not have access to internet

#

Then how did you used npm install? Without internet

cloud cave
#

Proper repository that contains all dependency

atomic magnet
#

hmmm

#

Maybe you could add in this dependency a placeholder for your module?