serverless-plugin-typescript: Error EPERM: operation not permitted, version 1.1.9
When I tried to run ‘sls deploy’, the following error is shown:
EPERM: operation not permitted, unlink '/Users/sofyan.ahmad/Projects/project-name/.build/node_modules'
The error is gone when I reverted back to version 1.1.7
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 59
- Comments: 58 (2 by maintainers)
Commits related to this issue
- Removes .build/node_modules instead of unlinking it during packaging Fixes #170 — committed to thiagohirata/serverless-plugin-typescript by thiagohirata 4 years ago
- fix: #170 Removes .build/node_modules instead of unlinking it during packaging — committed to thiagohirata/serverless-plugin-typescript by thiagohirata 4 years ago
- #170, #219 - Replaced unlinkSync to removeSync to remove node_modules when packaging serverless project — committed to joaogameprog/serverless-plugin-typescript by joaojuniorbexs 2 years ago
I am unable to reproduce this one 😞 Are you using webpack? There’s another issue surrounding webpack users at the moment which may be related.
Have you tried removing the
.buildand.serverlessfolders?I honestly don’t think serverless-plugin-typescript is to “blame” for this. I think something in the underlying fs-package messes up symlinks…
I’ve managed to fix this error by deleting the
.build/.serverless/whatever directories andnode-modules-directory… that solved the issue for me…This issue is still happening
folder permissions issue when building:
$ sudo rm -rf .build/
@vicary still having an issue
fixing when downgraded to v1.1.7
I am also using Prisma and @kobayashiharuto 's answer fixed the error, but it will obviously increases the bundle size. My solution was to change
serverless.yml, addingand moving the Prisma excluded paths under every single function using Prisma:
Docs reference here. That’s less elegant but at least avoids to hit the 50MB Lambda size limit.
In my case, the cause was
package.patternsinserverless.yml.I am using prisma and was following this document as written, when an error occurred. Instead of using the patterns described in this document as is, I commented out the top two as follows, and it worked.
Constantly having this issue, must remove the emit directory
.buildbefore deploying.This usually happens upon build time exceptions, user interrupts during compilation also triggers this issue.
version
2.1.0ofserverless-plugin-typescriptOne year after the bug reports this keeps happening.
Deleting .build and .serverless did the trick.
I’ve noticed that this issue sometimes happens if you’ve CTRL-C killed a deploy (for whatever reason) while it’s in the middle of running. Left in an inconsistent state perhaps?
As suggested the solution for me was to delete
.buildand thesls deployHTH
Still getting this issue on 2.1.0
I recently published a new version from my forked repo on npm: @kingdarboja/serverless-plugin-typescript
Please test it as I merged several PRs from this repo in order to solve several issues, including this one.
Cheers!
Getting same error with
"serverless-plugin-typescript": "^1.1.9"on my project. Using Windows 10 and Node 12.UPDATE Maybe the
fs.unlinkSyncon this commit for v1.1.8 is causing the issue.Downgrading to v1.1.7 worked whilst v1.1.8 (and v1.1.9) errored.
I noticed that with v1.1.7, running
sls packagewill create symlinks for the.build/node_modulesdirectory.Using v1.1.8 (or v1.1.9) it’s no longer a symlink. Something in the v1.1.8 release broke this.
Deleting
.buildthen runningsls deployworked for meI had a local dependency like:
The error
EPERM: operation not permittedwas present. I changed to1.1.7and the error was gone.We are having to problem aswell… no WebPack and on Windows…
And reverting from 1.1.9 to 1.1.7 worked for me as well.
I mixed up npm and yarn… Removed
.build.serverlessandpackage-lock.jsonreinstallednode_modulesand it worked afterStill getting this issue with
2.1.1ofserverless-plugin-typescriptFWIW, my issue was that I needed to delete my .build folder before running the script.
As mentioned downgrading to
serverless-plugin-typescript1.1.7 worked for me@httpiga’s solution worked for me with
2.1.2Downgrading to
1.1.7was the only solution that worked for meSame here, 1.1.9 failed on the
.builddirectory being present. Downgraded to 1.1.7 and it worked. serverless plugins installed:serverless-plugin-typescriptserverless-offlineserverless-dotenv-pluginWe had a similar issue in
serveless-localstackrepo which has a fix: https://github.com/localstack/serverless-localstack/issues/34I’m getting
Error: ENOENT: no such file or directory, open '/my-project/.build/node_modules/.bin/json2yaml'when I pin version
1.1.7Downgraded to v1.1.7. What a miserable day for productivity this was.
Ensuring adequate permissions for local user on node-modules, .build, .serverless had not affect for me.