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.

bug: global installation via pnpm cannot find modules

See original GitHub issue

Choose one: ๐Ÿ› bug report

๐ŸŽ› Configuration (.babelrc, package.json, cli command)

No babel configuration, itโ€™s my first install and I just wanted to try it out.

๐Ÿค” Expected Behavior

Running parcel index.html should start the live server.

๐Ÿ˜ฏ Current Behavior

Build fails with an error about missing modules. Running pnpm install -g posthtml-parser fixed the first one, but then it complains about posthtml-render.

๐Ÿšจ  Cannot find module 'posthtml-parser'
    at Function.Module._resolveFilename (module.js:489:15)
    at Function.Module._load (module.js:439:25)
    at Module.require (module.js:517:17)
    at require (/home/vortex/.nvm/versions/node/v8.3.0/pnpm-global/1/node_modules/.registry.npmjs.org/v8-compile-cache/1.1.0/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/home/vortex/.nvm/versions/node/v8.3.0/pnpm-global/1/node_modules/.registry.npmjs.org/parcel-bundler/1.4.0/node_modules/parcel-bundler/src/assets/HTMLAsset.js:2:15)
    at Module._compile (/home/vortex/.nvm/versions/node/v8.3.0/pnpm-global/1/node_modules/.registry.npmjs.org/v8-compile-cache/1.1.0/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)

๐Ÿ’ Possible Solution

it seems this is as a result of pnpm not flattening dependencies.

๐Ÿ”ฆ Context

๐Ÿ’ป Code Sample

๐ŸŒ Your Environment

Software Version(s)
Parcel 1.4.0
Node 8โ€ฆ3.0
pnpm 1.25.1
Operating System Peppermint 8 Linux

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
bmacnaughtoncommented, Aug 20, 2020

@yoanthiebault - itโ€™s the same reason iโ€™m seeing an error when tap/bin/jack.js attempt to load treport/types on line 8. (tap v14.10.8). treport/types is not declared as a dependency in package.json.

1reaction
jsumnerscommented, Feb 13, 2018

Having the same issue. Modules that are direct dependencies should be listed as so in the package.json.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module not found if installing a package in global with pnpm
I am trying to install prettier with pnpm install prettier -g , and when I ... Error: Cannot find module '/Users/hugosum/pnpm-global/5/ย ...
Read more >
Installation | pnpm
You may install pnpm even if you don't have Node.js installed, using the ... Error: Cannot find module 'C:\Users\Bence\AppData\Roaming\npm\pnpm-global\4\ย ...
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
To fix the error, you need to install the package that is absent in your project directory โ€“ npm install package-name or yarn...
Read more >
pnpm/pnpm - Gitter
How do I debug node after using pnpm install? ... node:internal/modules/cjs/loader:944 throw err; ^ Error: Cannot find module ...
Read more >
pnpm - npm
Fast, disk space efficient package manager. Latest version: 7.20.0, last published: 2 days ago. Start using pnpm in your project by runningย ...
Read more >

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 Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found