Anyone else have every `npm install` freeze on `re...
# help
a
Anyone else have every
npm install
freeze on
reify:node-sass
for two minutes every single time. I think it's related to having a react app in my NPM workspace pulling the current version of that, and SST depending on next.js depending on on old version of node-sass that fails to compile.
t
I've been seeing this for like 4 years lol
never dug into it
Wait SST pulls in node-sass? It's not part of your deps?
a
node_modules/@serverless-stack/nextjs-core depends on node_modules/@serverless-stack/nextjs-core/node_modules/next has peer dependency node-sass ^4.0.0 || ^5.0.0 (old) which pulls in bundle node_modules/@serverless-stack/nextjs-core/node_modules/node-sass@5.0.0
Don't know if related, but didn't have this problem before SST.
t
ah I'm not too familiar with our nextjs construct - @Frank can probably explain it
a
I'm not using it, it's just in the dependencies.
t
Yeah makes sense
a
I do have a React webapp in the NPM workspace that pulls node-sass v6. As I recall for researching this before, there was a known problem compiling node-sass that was fixed in v6.
d
Just to weigh in, I have sporadic issues with the install taking awhile (I have a bunch of Nextjs apps, but it seems to also occur with APIs + Apollo equally). I also agree that it must be due to clashing dependency versions, so its deciding and installing several nested ones.
I would love if we could go to all, or partial
peerDependencies
instead, would also make bundles smaller and other such benefits.
a
My Macbook is trying and failing. Here's the NPM debug output - no exception, it just take two minutes to return a 1 failure code. When running I see clang (C compiler) is doing work. Looks like a timeout and then since it fails, tries again upon the next npm install.
Copy code
npm info run node-sass@5.0.0 postinstall { code: 1, signal: null }
npm timing build:run:postinstall:node_modules/@serverless-stack/nextjs-core/node_modules/node-sass Completed in 107411ms
npm timing build:run:postinstall Completed in 107411ms
t
This probably should be in peer deps but we generally can't put a lot of things in there, only things we assume the user already has installed
personally I'd like SST to do less but some people do go to it for testing/linting setup out of the box so we need to make those hard deps
a
Simply upgrading to latest may fix it. node-sass@6.0.1 is installing fine for my react webapp.
d
I have tried some strategies to force npm to ignore the
@serverless-stack
dependencies, and instead use the installed ones, but pretty much everything has made the issue worse...has anyone else had any success?
are you on ARM @Adam Fanello? what version of Node/NPM?
a
2018 Macbook Pro x86. node v16.13.1 npm 8.1.2
d
Hmmm, I'm on Linux and 14.18.3/8.3.0, but that's pretty small potatoes, it has to be something specific to your App.
I have an idea on how to allow flexibility, while still meeting SST batteries included requirements, will propose in a little while in #sst.
a
node-sass requires a native compilation during install - that's what is failing. That compilation can certainly be broken on MacOS but not Linux.
j
@Adam Fanello just to check here, is the
node-sass
dependency coming from SST?
d
@Jay
node_modules/@serverless-stack/nextjs-core depends on
node_modules/@serverless-stack/nextjs-core/node_modules/next has peer dependency
node-sass ^4.0.0 || ^5.0.0 (old) which pulls in bundle
node_modules/@serverless-stack/nextjs-core/node_modules/node-sass@5.0.0
j
@Frank not sure if you’ve seen this. This
node-sass
thing is an issue.
Thx @Derek Kershner.
d
https://github.com/vercel/next.js/discussions/25844 Not sure it's on you guys to fix. And it appears to be a Node 16 issue (not Mac)
a
Right, that fits. As I stated (I think?) the base problem is that next.js, bundled with SST, is depending on an old version of node-sass. node-sass v6 fixes it.
d
The clarification (for me, at least), was that the problem stems from your use of Node 16 (as opposed to my use of Node 14). Agreed on fix.
a
I'm using NPM Workspaces, which requires NPM 7+. Node 14 only comes with NPM 6 and dealing with all developers and CI/CD needing to manually upgrade NPM within a Node 14 context is its own mess vs 2 minute delays. Holding out for a proper fix.
d
I will be in the same boat once lambdas hit Node 16, but I am indeed doing a pile of NPM upgrades in the meantime. (also using NPM workspaces)
a
Here's the fix in next.js https://github.com/vercel/next.js/pull/28710 Unfortunately they refused to patch it in next v11, so you have to go through the pain of a v12 update to support Node 16. 😞 Why is this even a dependency... live debug server?
d
There is hardly any difference between 11 and 12, I upgraded with no noticeable change, and zero code or deployment changes.
a
Node 16 is latest LTS, so this is the time.
f
Yeah, we are going to move the nextjs stuff out to a separate package. That should get around this issue.
a
Frank, is that dependency there for live debugging or to deploy a Next.js static site?
f
For building actually. The
NextjsSite
construct uses the
serverless-nextjs
project to run
next build
and package the output into Lambda@Edge functions. And the
serverless-nextjs
has
next
as a dependencies. That’s where
node-sass
comes from.
a
Good - then my team won't need it once split out.