styled-components: cannot find module node_modules/styled-components/postinstall.js
issue when installing styled-components through npm.
command:
npm install styled-components
error:
npm ERR! code 1
npm ERR! path /home/kp/Code/Javascript/blog-website/node_modules/styled-components
npm ERR! command failed
npm ERR! command sh -c node ./postinstall.js
npm ERR! node:internal/modules/cjs/loader:936
npm ERR! throw err;
npm ERR! ^
npm ERR!
npm ERR! Error: Cannot find module '/home/kp/Code/Javascript/blog-website/node_modules/styled-components/postinstall.js'
npm ERR! at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
npm ERR! at Function.Module._load (node:internal/modules/cjs/loader:778:27)
npm ERR! at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
npm ERR! at node:internal/main/run_main_module:17:47 {
npm ERR! code: 'MODULE_NOT_FOUND',
npm ERR! requireStack: []
npm ERR! }
npm ERR!
npm ERR! Node.js v17.7.1
npm ERR! A complete log of this run can be found in:
npm ERR! /home/kp/.npm/_logs/2022-03-24T13_48_17_174Z-debug-0.log
npx envinfo:
## System:
- OS: Linux 5.15 Manjaro Linux
- CPU: (8) x64 Intel(R) Core(TM) i3-10320 CPU @ 3.80GHz
- Memory: 12.17 GB / 15.48 GB
- Container: Yes
- Shell: 5.1.16 - /bin/bash
## Binaries:
- Node: 17.7.1 - /usr/bin/node
- Yarn: 1.22.17 - /usr/bin/yarn
- npm: 8.5.4 - /usr/bin/npm
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 10
- Comments: 24 (3 by maintainers)
Commits related to this issue
- fix: bug version for styled-components@5.3.4 https://github.com/styled-components/styled-components/issues/3706 — committed to cnpm/bug-versions by afc163 2 years ago
- fix: bug version for styled-components@5.3.4 (#184) https://github.com/styled-components/styled-components/issues/3706 — committed to cnpm/bug-versions by afc163 2 years ago
Fixed in 5.3.5 sorry about that
same problem
Worked for me. But I had to add resolutions field in package.json (I use yarn) “resolutions” : { “styled-components”: “5.3.3” }
same problem
same problem, hope it resovled as soon as possible
for a while you can install npm install styled-components@5.3.3
We’re still injecting politics into OSS? I don’t know why it’s such a trend/fad to target this issue of the thousands of issues and atrocities in the world. But it is immature, and is not the place of software engineers to be playing with and using open source as a platform. This is childish behavior. Just put it in your blog, do something real that actually supports Ukraine, and leave the code out of it.
https://security.snyk.io/vuln/SNYK-JS-STYLEDCOMPONENTS-3149924
It would behoove of you to take after Snyk’s example from their statements on node-ipc:
“Even if the deliberate and dangerous act of maintainer RIAEvangelist will be perceived by some as a legitimate act of protest. How does that reflect on the maintainer’s future reputation and stake in the developer community? Would this maintainer ever be trusted again to not follow up on future acts in such or even more aggressive actions for any projects they participate in?”
“Snyk stands with Ukraine and we’ve proactively acted to support the Ukrainian people during the on-going crisis with donations and free service to developers world-wide, as well as taking action to cease business in Russia and Belarus. That said, intentional abuse such as this undermines the global open source community and requires us to flag impacted versions of node-ipc as security vulnerabilities.”
The absolute irony of labeling the issue that called this out as spam… 🤦
Sure thing, I forgot to expose the file in the package.json config.