1

I'm trying to create a snowpack project, which already fails by the basic start.

I set up a basic snowpack project, but when I try to start my dev server it will fail because of this line:

import * as fs from "fs/promises";

Showing me:

▼ Console

[snowpack] ! building dependencies...
[snowpack] Package "fs/promises" not found. Have you installed it? 

But I think node is installed... How can I use fs with snowpack?

Basically I wanted to build an app with selenium-webdriver but this fails even more, since it imports more libraries that are not loaded. fs is one of them. And I don't understand what rollup is doing and if this will be the right way to 'bundle` (?) fs ?

UPDATE:

Using:

import * as fs from "fs";

will work, when running npx tsc file.ts && node file.js, but it shows in snowpack I still get the error:

▼ Console

[snowpack] ! building dependencies...
[snowpack] Package "fs" not found. Have you installed it? 

npm ERR! code 1
npm ERR! path /home/user/snowpackproject/scraper
npm ERR! command failed
npm ERR! command sh -c snowpack dev --polyfill-node
user2853437
  • 750
  • 8
  • 27

0 Answers0