question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parcel can`t find module "@parcel/transformer-sass" and callback must be a function

See original GitHub issue

🐛 bug report

I want to create my simple project with Parcell. But I can`t use scss for it because Parcel cannot find plugin “@parcel/transformer-sass”.

🎛 Configuration (.babelrc, package.json, cli command)

{ “name”: “parcel-test”, “version”: “1.0.0”, “description”: “”, “main”: “index.js”, “source”: “src/index.html”, “scripts”: { “test”: “echo "Error: no test specified" && exit 1”, “start”: “parcel”, “build”: “parcel build” }, “devDependencies”: { “@parcel/transformer-sass”: “^2.0.0”, “parcel”: “^2.0.0”, “sass”: “^1.43.4” } }

🤔 Expected Behavior

I expect same like this

Parcel supports Sass files automatically using the @parcel/transformer-sass plugin. When a .sass or .scss file is detected, it will be installed into your project automatically.

😯 Current Behavior

When I wrote <link rel="stylesheet" href="index.scss">

I saw the following:

`@parcel/core: Cannot find Parcel plugin "@parcel/transformer-sass"

  C:\Users\newse\Desktop\parcel-test\node_modules\@parcel\config-default\index.json:25:23
    24 |     "*.{styl,stylus}": ["@parcel/transformer-stylus"],
  > 25 |     "*.{sass,scss}": ["@parcel/transformer-sass"],
  >    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^ Cannot find module "@parcel/transformer-sass"
    26 |     "*.less": ["@parcel/transformer-less"],
    27 |     "*.{css,pcss}": ["@parcel/transformer-postcss", "@parcel/transformer-css"],

When I restarted Parcel I saw

Error: Failed to install @parcel/transformer-sass: Callback must be a function. Received undefined

  Error: Failed to install @parcel/transformer-sass: Callback must be a function. Received undefined
  at install (C:\Users\newse\Desktop\parcel-test\node_modules\@parcel\package-manager\lib\installPackage.js:131:11)    
  at processTicksAndRejections (node:internal/process/task_queues:96:5)
  at async PromiseQueue._runFn (C:\Users\newse\Desktop\parcel-test\node_modules\@parcel\utils\lib\PromiseQueue.js:88:7)
  at async PromiseQueue._next (C:\Users\newse\Desktop\parcel-test\node_modules\@parcel\utils\lib\PromiseQueue.js:75:5)

I added @parcel/transformer-sass manually to devDependencies, but it didn’t solve the problem

💁 Possible Solution

Maybe I need to use earlier versions of Parcel.

🔦 Context

💻 Code Sample

🌍 Your Environment

Software Version(s)
Parcel v2.0.0
Node v16.13.0
npm/Yarn v8.1.1
Operating System windows 10

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
photocuriocommented, Mar 2, 2022

This issue still appears if you install Parcel as a dependency. It must be installed as a dev dependency: npm install parcel --save-dev

3reactions
ostrowrcommented, Dec 16, 2021

There is something odd going on with module resolution for @parcel/transformer-sass in particular.

My project looks like this

- package.json (1)
- subfolder
--- package.json (2)
--- .parcelrc

If @parcel/transformer-sass is installed in package.json (2), we get Cannot find module "@parcel/transformer-sass". If it’s installed in the base package.json (1), it works.

Can’t replicate with other plugins like @parcel/transformer-stylus.

This only happens, of course, when --no-autoinstall is set.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found