Hey!
I’m working on my new portfolio and when I try to deploy it on Netlify, I got this error:
I tried to add CI=
before npm run build
but it doesn’t work.
The last error displayed is:
Failed during stage 'building site': Build script returned non-zero exit code: 2
I’m a bit rusty and I can’t find any help on previous similar posts
Welcome to the forums @Reikurooo
Strange error.
> parcel build ./src/index.html
[Error: std::bad_alloc]
I cloned your repo and was able to deploy successfully . I made two changes:
Removed "main": "index.js",
from package.json
as it is incorrect.
Added .parcel-cache
to .gitignore
so it isn’t pushed to git.
It is possible the .parcel-cache
is the root cause, however cannot say for sure. A Support Engineer may have more insight on this.
Damn thank you! It was this folder the issue.
When I used to dev more I never had an issue with this folder, until now ahah.
Have a nice day
This helped me out, the .parcel-cache in repo was causing me issues.
1 Like
So glad that this thread helped, thanks for letting us know!
Hello! Did you just delete `“main”: “index.js” from package.json or did you replace it with index.html?
coelmay:
Welcome to the forums @Reikurooo
Strange error.
> parcel build ./src/index.html
[Error: std::bad_alloc]
I cloned your repo and was able to deploy successfully . I made two changes:
Removed "main": "index.js",
from package.json
as it is incorrect.
Added .parcel-cache
to .gitignore
so it isn’t pushed to git.
It is possible the .parcel-cache
is the root cause, however cannot say for sure. A Support Engineer may have more insight on this.
Should i apply it on index.php?
Hi @richr0ll
I removed it. As per package.json
documentation
The main field is a module ID that is the primary entry point to your program. That is, if your package is named foo
, and a user installs it, and then does require("foo")
, then your main module’s exports object will be returned.
As this is not a program/package/module that is installed, and instead a website, this value isn’t necessarily required.
Although I do note many of the @parcel-bundler
examples do set "main": "src/index.html"
. I can confirm after testing react example, removing main
does not affect the build.