FredKSchott / create-snowpack-app

The all-in-one app template for Snowpack. [moved]

Home Page:https://www.snowpack.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when installing Cheerio.js

luchoster opened this issue · comments

I'm trying to use Cheerio on my React app, and after installing the package, when I run yarn start I get:

⠼ snowpack installing... axios, cheerio, ramda, react, react-dom
✖ 'stream' is imported by 'node_modules/parse5/lib/parser/parser_stream.js', but could not be resolved.
  'stream' is a Node.js builtin module that won't exist in the browser.
  Find a more web-friendly alternative, or add the "rollup-plugin-node-polyfills" plugin to your Snowpack config file.
✖ 'stream' is imported by 'node_modules/parse5/lib/serializer/serializer_stream.js', but could not be resolved.
  'stream' is a Node.js builtin module that won't exist in the browser.
  Find a more web-friendly alternative, or add the "rollup-plugin-node-polyfills" plugin to your Snowpack config file.
✖ 'util' is imported by 'node_modules/parse5/lib/parser/parser_stream.js', but could not be resolved.
  'util' is a Node.js builtin module that won't exist in the browser.
  Find a more web-friendly alternative, or add the "rollup-plugin-node-polyfills" plugin to your Snowpack config file.
✖ 'stream' is imported by 'node_modules/parse5/lib/sax/index.js', but could not be resolved.
  'stream' is a Node.js builtin module that won't exist in the browser.
  Find a more web-friendly alternative, or add the "rollup-plugin-node-polyfills" plugin to your Snowpack config file.
✖ 'util' is imported by 'node_modules/parse5/lib/parser/plain_text_conversion_stream.js', but could not be resolved.
  'util' is a Node.js builtin module that won't exist in the browser.
  Find a more web-friendly alternative, or add the "rollup-plugin-node-polyfills" plugin to your Snowpack config file.
✖ 'util' is imported by 'node_modules/parse5/lib/sax/index.js', but could not be resolved.
  'util' is a Node.js builtin module that won't exist in the browser.
  Find a more web-friendly alternative, or add the "rollup-plugin-node-polyfills" plugin to your Snowpack config file.
✖ 'util' is imported by 'node_modules/parse5/lib/serializer/serializer_stream.js', but could not be resolved.
  'util' is a Node.js builtin module that won't exist in the browser.
  Find a more web-friendly alternative, or add the "rollup-plugin-node-polyfills" plugin to your Snowpack config file.
✖ 'stream' is imported by 'stream?commonjs-external', but could not be resolved.
  'stream' is a Node.js builtin module that won't exist in the browser.
  Find a more web-friendly alternative, or add the "rollup-plugin-node-polyfills" plugin to your Snowpack config file.
✖ 'util' is imported by 'util?commonjs-external', but could not be resolved.
  'util' is a Node.js builtin module that won't exist in the browser.
  Find a more web-friendly alternative, or add the "rollup-plugin-node-polyfills" plugin to your Snowpack config file.
✖ 'stream' is imported by 'node_modules/parse5/lib/sax/dev_null_stream.js', but could not be resolved.
  'stream' is a Node.js builtin module that won't exist in the browser.
  Find a more web-friendly alternative, or add the "rollup-plugin-node-polyfills" plugin to your Snowpack config file.
✖ 'util' is imported by 'node_modules/parse5/lib/sax/dev_null_stream.js', but could not be resolved.
  'util' is a Node.js builtin module that won't exist in the browser.
  Find a more web-friendly alternative, or add the "rollup-plugin-node-polyfills" plugin to your Snowpack config file.
✖ 'events' is imported by 'node_modules/htmlparser2/lib/Parser.js', but could not be resolved.
  'events' is a Node.js builtin module that won't exist in the browser.
  Find a more web-friendly alternative, or add the "rollup-plugin-node-polyfills" plugin to your Snowpack config file.
✖ 'buffer' is imported by 'node_modules/htmlparser2/lib/WritableStream.js', but could not be resolved.
  'buffer' is a Node.js builtin module that won't exist in the browser.
  Find a more web-friendly alternative, or add the "rollup-plugin-node-polyfills" plugin to your Snowpack config file.
✖ 'util' is imported by 'node_modules/parse5/lib/extensions/location_info/tokenizer_mixin.js', but could not be resolved.
  'util' is a Node.js builtin module that won't exist in the browser.
  Find a more web-friendly alternative, or add the "rollup-plugin-node-polyfills" plugin to your Snowpack config file.
✖ 'util' is imported by 'node_modules/parse5/lib/extensions/location_info/parser_mixin.js', but could not be resolved.
  'util' is a Node.js builtin module that won't exist in the browser.
  Find a more web-friendly alternative, or add the "rollup-plugin-node-polyfills" plugin to your Snowpack config file.
✖ 'events' is imported by 'events?commonjs-external', but could not be resolved.
  'events' is a Node.js builtin module that won't exist in the browser.
  Find a more web-friendly alternative, or add the "rollup-plugin-node-polyfills" plugin to your Snowpack config file.
✖ 'buffer' is imported by 'buffer?commonjs-external', but could not be resolved.
  'buffer' is a Node.js builtin module that won't exist in the browser.
  Find a more web-friendly alternative, or add the "rollup-plugin-node-polyfills" plugin to your Snowpack config file.
✖ 'util' is imported by 'node_modules/parse5/lib/extensions/location_info/open_element_stack_mixin.js', but could not be resolved.
  'util' is a Node.js builtin module that won't exist in the browser.
  Find a more web-friendly alternative, or add the "rollup-plugin-node-polyfills" plugin to your Snowpack config file.
✖ 'util' is imported by 'node_modules/parse5/lib/extensions/position_tracking/preprocessor_mixin.js', but could not be resolved.
  'util' is a Node.js builtin module that won't exist in the browser.
  Find a more web-friendly alternative, or add the "rollup-plugin-node-polyfills" plugin to your Snowpack config file.
✖ 'buffer' is imported by 'node_modules/safe-buffer/index.js', but could not be resolved.
  'buffer' is a Node.js builtin module that won't exist in the browser.
  Find a more web-friendly alternative, or add the "rollup-plugin-node-polyfills" plugin to your Snowpack config file.
✔ snowpack install complete. [8.77s]

  ⦿ web_modules/                            size       gzip       brotli   
    ├─ axios.js                             39.06 KB   10.34 KB   8.98 KB    
    ├─ cheerio.js                           987.43 KB  227.38 KB  141.97 KB  
    ├─ ramda.js                             290.77 KB  66.91 KB   51.05 KB   
    ├─ react-dom.js                         896.31 KB  204.74 KB  160.39 KB  
    └─ react.js                             0.65 KB    0.4 KB     0.32 KB    
  ⦿ web_modules/common/ (Shared)
    ├─ _commonjsHelpers-7dcf7119.js         0.64 KB    0.32 KB    0.25 KB    
    └─ index-5353e8e6.js                    69.48 KB   18.79 KB   15.93 KB   


error Command failed with exit code 1.

this is my snowpack.config.json. I added the rollup-plugin-node-polyfills but I probably did it wrong, any idea how to fix that?

snowpack-config

This is a documentation issue that we need to resolve, where we currently support two different types of plugins: Snowpack plugins & Rollup Install plugins. Your config should instead be:

"installOptions": {
  "rollup": {
    "plugins": ["rollup-plugin-node-polyfills"]
  }
}

And then you can remove that plugin from the top-level plugins config.