#Hi any idea why this is happening

1 messages · Page 1 of 1 (latest)

fringe hamlet
#

Just quick double check, you have run yarn upgrade and yarn install -dev since adding the @dagger.io/dagger dependency?

slow tusk
#

I am using npm. I already ran npm install

#

also npm install --production=false to ensure the dev dependencies were added

#
node_modules/@dagger.io$ ls -alR
.:
total 12
drwxrwxr-x   3 vikram vikram 4096 Sep 26 20:21 .
drwxrwxr-x 135 vikram vikram 4096 Sep 26 20:21 ..
drwxrwxr-x   2 vikram vikram 4096 Sep 26 20:21 dagger

./dagger:
total 28
drwxrwxr-x 2 vikram vikram  4096 Sep 26 20:21 .
drwxrwxr-x 3 vikram vikram  4096 Sep 26 20:21 ..
-rw-rw-r-- 1 vikram vikram 11358 Sep 26 20:21 LICENSE
-rw-rw-r-- 1 vikram vikram   621 Sep 26 20:21 package.json
-rw-rw-r-- 1 vikram vikram  1656 Sep 26 20:21 README.md
fringe hamlet
#

huh okay, well one thing right away, if this code is intended to be an extension then you probably want to switch to using yarn for now (there's an issue here for being yarn/npm agnostic: https://github.com/dagger/dagger/issues/3036)

But either way I would still think this should work. What are the contents of ./dagger/package.json ?

slow tusk
#

It's not intended as an extension. I'm trying to use cloak to build and push an image of this nodejs app

#
$ cat dagger/package.json 
{
  "name": "@dagger.io/dagger",
  "version": "1.0.0",
  "license": "Apache-2.0",
  "type": "module",
  "types": "./sdk/nodejs/dagger/dist/index.d.ts",
  "files": [
    "./sdk/nodejs/dagger/dist/"
  ],
  "exports": {
    ".": "./sdk/nodejs/dagger/dist/index.js"
  },
  "dependencies": {
    "@lifeomic/axios-fetch": "^3.0.0",
    "axios": "^0.27.2",
    "execa": "^6.1.0",
    "graphql": "^16.5.0",
    "graphql-request": "^5.0.0",
    "graphql-tag": "^2.12.6",
    "node-fetch": "^3.2.10"
  },
  "scripts": {
    "build": "tsc"
  },
  "devDependencies": {
    "@types/node": "^18.7.18",
    "typescript": "^4.8.3"
  }
}
fringe hamlet
#

Hm okay, so I just tried myself and when I ran npm install --production=false I end up with this in node_modules:

ls -la node_modules/\@dagger.io/dagger/
total 32
drwxr-xr-x 3 sipsma sipsma  4096 Sep 26 08:17 .
drwxr-xr-x 3 sipsma sipsma  4096 Sep 26 08:16 ..
-rw-r--r-- 1 sipsma sipsma 11358 Sep 26 08:17 LICENSE
-rw-r--r-- 1 sipsma sipsma   621 Sep 26 08:17 package.json
-rw-r--r-- 1 sipsma sipsma  1656 Sep 26 08:17 README.md
drwxr-xr-x 3 sipsma sipsma  4096 Sep 26 08:17 sdk

So I got the sdk dir, which seems like is missing for you

slow tusk
#

huh weird

fringe hamlet
#

I have no idea why that'd be, just to double check, can you rm -rf node_modules and try re-running npm install --production=false?

slow tusk
#

just did that

#
$ rm -rf node_modules/
$ npm install --production=false
npm WARN deprecated transformers@2.1.0: Deprecated, use jstransformer
npm WARN deprecated constantinople@3.0.2: Please update to at least constantinople 3.1.1
npm WARN deprecated jade@1.11.0: Jade has been renamed to pug, please install the latest version of pug instead of jade

added 144 packages, and audited 145 packages in 10s

13 packages are looking for funding
  run `npm fund` for details

5 vulnerabilities (1 low, 4 critical)

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
$ node scripts/build.mjs 
node:internal/errors:465
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module 
...
Node.js v18.0.0
#

what version of nodejs are you using?

fringe hamlet
slow tusk
#

In your package-lock.json, do you see any differences to this below from mine?

    "node_modules/@dagger.io/dagger": {
      "version": "1.0.0",
      "resolved": "git+ssh://git@github.com/dagger/dagger.git#bf8ef7ed97d1463d0cc1c3d492032e3fd125be3e",
      "dev": true,
      "license": "Apache-2.0",
      "dependencies": {
        "@lifeomic/axios-fetch": "^3.0.0",
        "axios": "^0.27.2",
        "execa": "^6.1.0",
        "graphql": "^16.5.0",
        "graphql-request": "^5.0.0",
        "graphql-tag": "^2.12.6",
        "node-fetch": "^3.2.10"
      }
    },
fringe hamlet
# slow tusk In your package-lock.json, do you see any differences to this below from mine? ...

Nope looks the same:

    "node_modules/@dagger.io/dagger": {
      "version": "1.0.0",
      "resolved": "git+ssh://git@github.com/dagger/dagger.git#bf8ef7ed97d1463d0cc1c3d492032e3fd125be3e",
      "dev": true,
      "license": "Apache-2.0",
      "dependencies": {
        "@lifeomic/axios-fetch": "^3.0.0",
        "axios": "^0.27.2",
        "execa": "^6.1.0",
        "graphql": "^16.5.0",
        "graphql-request": "^5.0.0",
        "graphql-tag": "^2.12.6",
        "node-fetch": "^3.2.10"
      }
    },

The only thing I can think of is to try npm cache clean --force and then recreate node_modules again. I did have to do that at one point in the past when using git dependencies to fix some inconsistency

#

Node version differences are always possible too

#

cc @dull plover @gentle sentinel in case you are around and have any clues about what would cause the sdk dir to be missing when Vikram imports the sdk (whereas the exact same command seems to work for me)

slow tusk
#

OK just did above cache clean and reinstall, no change

fringe hamlet
slow tusk
#

will try in a docker container for a diff node version next

fringe hamlet
slow tusk
#

works in nodejs 16

#

huh also works in docker container for nodejs 18

#

so something weird in my local env then

#

i wonder why

#

sorry for the noise