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

npm install on create-daml-app fails with npm=9.3.1, nodejs=18.14.0 #16258

Closed
cocreature opened this issue Feb 7, 2023 · 10 comments
Closed

npm install on create-daml-app fails with npm=9.3.1, nodejs=18.14.0 #16258

cocreature opened this issue Feb 7, 2023 · 10 comments

Comments

@cocreature
Copy link
Contributor

Running npm install on create-daml-app (after generating the files is) fails because it cannot find a file:

[nix-shell:~/create-daml-app/ui]$ npm install
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /home/moritz/create-daml-app/ui/node_modules/@daml.js/40f452260bef3f29dede136108fc08a88d5a5250310281067087da6f0baddff7/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/home/moritz/create-daml-app/ui/node_modules/@daml.js/40f452260bef3f29dede136108fc08a88d5a5250310281067087da6f0baddff7/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/moritz/.npm/_logs/2023-02-07T14_53_57_699Z-debug-0.log

I think it may be an NPM 8 vs NPM 9 issue.

You can repro with

NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/e75e7234275c413d038341764a3426245e0fb174.zip nix-shell -p nodejs-18.x
@basvangijzel-DA
Copy link
Contributor

This is also a problem on Windows (and our Windows ad-hoc machines).

NPM version: 9.3.1
Node version: 10.4.0

@basvangijzel-DA
Copy link
Contributor

C:\daml\create-daml-app\ui>npm install
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\daml\create-daml-app\ui\node_modules\@daml.js\40f452260bef3f29dede136108fc08a88d5a5250310281067087da6f0baddff7/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\daml\create-daml-app\ui\node_modules\@daml.js\40f452260bef3f29dede136108fc08a88d5a5250310281067087da6f0baddff7\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\u\AppData\Local\npm-cache\_logs\2023-02-08T15_31_42_737Z-debug-0.log

@basvangijzel-DA
Copy link
Contributor

basvangijzel-DA commented Feb 8, 2023

It is indeed likely npm 9 that is at fault. When downgrading to the things that come with the 10.3.0 release:

NPM version: 8.19.3
Node version 10.3.0

Everything works

@garyverhaegen-da
Copy link
Contributor

This seems relevant: nodejs/node#46542.

Running

npm install --install-links false

works for me on both macOS and Windows. From what I can gather this used to be the default but they changed it in (Node) 18.14; there seems to be a chance they'll reverse that, so I'm not sure what the appropriate action is on our side.

Updating the instructions seems like a good approach as it should be harmless either way (i.e. whichever default they end up sticking with, explicitly setting the value should work).

@pragmaxim
Copy link

npm install --install-links false actually works on Linux too with :

  npm: '9.4.0',
  node: '19.6.1',

There is a lot of great daml examples out there but they are hard to run due to nodejs version issues.

@pragmaxim
Copy link

well, npm start then fails as node_modules/@daml.js/ is empty :-/

@garyverhaegen-da
Copy link
Contributor

well, npm start then fails as node_modules/@daml.js/ is empty :-/

I don't have a Linux environment handy right now, but that shouldn't be the case. Can you double-check you have run daml codegen js before npm install?

@pragmaxim
Copy link

pragmaxim commented Feb 28, 2023

I don't have a Linux environment handy right now, but that shouldn't be the case. Can you double-check you have run daml codegen js before npm install?

Yes I did, it ends up with the same error as in #16258 (comment)

One time I worked around that issue manually by commenting out daml.js dep and installing it afterwards but then I got this on npm start (on a different project) :

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:140:10)

I've played with a bunch of daml projects and they all worked fine on Node version 16.16.0. Making them work with 18.14.0+ is beyond my frontend skills.

@garyverhaegen-da
Copy link
Contributor

It looks like it got fixed on the node side - at least for me the GSG now works out of the box (i.e. without having to add the --install-links flag) for 2.5.5 and 2.6.0 (both unreleased as of yet, but still) on Node 18.14.2 (npm 9.5.0).

@garyverhaegen-da
Copy link
Contributor

Closing as this is fixed as far as I can tell. Should anyone encounter this issue again please open a new ticket for it.

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

No branches or pull requests

4 participants