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: Incompatible with serverless-plugin-typescript

See original GitHub issue

When I add serverless-plugin-typescript to the project, I get some errors from typescript trying to unlink directories.

PR for a breaking build: https://github.com/dustyjewett/serverless-jetpack/pull/1 (I wasn’t able to run yarn test:cli before or after my changes, so I’m just assuming the tests break, as I’m able to run serverless package in the test directory on master, but it fails in my branch)

Serverless: Compiling with Typescript...
Serverless: Typescript compiled.
 
  Error --------------------------------------------------
 
  Error: EISDIR: illegal operation on a directory, unlink '/mnt/5aa17a51-a0c2-414d-aca1-4b6a28f5f4a0/projects/serverless-jetpack/test/packages/monorepo/yarn/.build/node_modules'
      at Object.unlinkSync (fs.js:956:3)
      at TypeScriptPlugin.<anonymous> (/mnt/5aa17a51-a0c2-414d-aca1-4b6a28f5f4a0/projects/serverless-jetpack/test/packages/monorepo/yarn/node_modules/serverless-plugin-typescript/src/index.ts:195:12)
      at Generator.next (<anonymous>)
      at /mnt/5aa17a51-a0c2-414d-aca1-4b6a28f5f4a0/projects/serverless-jetpack/test/packages/monorepo/yarn/node_modules/serverless-plugin-typescript/dist/src/index.js:7:71
      at new Promise (<anonymous>)
      at __awaiter (/mnt/5aa17a51-a0c2-414d-aca1-4b6a28f5f4a0/projects/serverless-jetpack/test/packages/monorepo/yarn/node_modules/serverless-plugin-typescript/dist/src/index.js:3:12)
      at TypeScriptPlugin.copyDependencies (/mnt/5aa17a51-a0c2-414d-aca1-4b6a28f5f4a0/projects/serverless-jetpack/test/packages/monorepo/yarn/node_modules/serverless-plugin-typescript/dist/src/index.js:166:16)
      at TypeScriptPlugin.<anonymous> (/mnt/5aa17a51-a0c2-414d-aca1-4b6a28f5f4a0/projects/serverless-jetpack/test/packages/monorepo/yarn/node_modules/serverless-plugin-typescript/src/index.ts:45:20)
      at Generator.next (<anonymous>)
      at fulfilled (/mnt/5aa17a51-a0c2-414d-aca1-4b6a28f5f4a0/projects/serverless-jetpack/test/packages/monorepo/yarn/node_modules/serverless-plugin-typescript/dist/src/index.js:4:58)
      at process._tickCallback (internal/process/next_tick.js:68:7)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

11reactions
wuelcascommented, Feb 18, 2020

I know this is closed but I had this exact issue on Jenkins after I added a new npm package to the project. Looks like Jenkins was persisting the old TS compiled files and link to the node_modules folder. What I did to solve it was deleting the output folder (my folder is named .build, so I just did a rm -rf .build) for the compiled files and then run serverless. Solve it for me.

2reactions
ryan-roemercommented, Jan 2, 2020

… I checked out your branch. With this diff:

$ git diff serverless.yml
diff --git a/test/packages/monorepo/yarn/serverless.yml b/test/packages/monorepo/yarn/serverless.yml
index 145bff8..38ff27f 100644
--- a/test/packages/monorepo/yarn/serverless.yml
+++ b/test/packages/monorepo/yarn/serverless.yml
@@ -24,7 +24,6 @@ plugins:
   modules:
     - serverless-plugin-typescript
     - serverless-offline
-    - ../../../plugins/wrapper
 
 provider:
   name: aws

Which completely removes serverless-jetpack under any condition and this package command:

$ SLS_DEBUG="*"   STAGE="sandbox"   AWS_REGION="us-east-1"   serverless package

I get your error, which means it’s not jetpack specific I think:

Serverless: Compiling with Typescript...
Serverless: Typescript compiled.
 
  Error --------------------------------------------------
 
  Error: EPERM: operation not permitted, unlink '/Users/rye/scm/vendor/jp-dustyjewett-ts-issue/test/packages/monorepo/yarn/.build/node_modules'
      at Object.unlinkSync (fs.js:956:3)
      at TypeScriptPlugin.<anonymous> (/Users/rye/scm/vendor/jp-dustyjewett-ts-issue/test/packages/monorepo/yarn/node_modules/serverless-plugin-typescript/src/index.ts:195:12)
      at Generator.next (<anonymous>)
      at /Users/rye/scm/vendor/jp-dustyjewett-ts-issue/test/packages/monorepo/yarn/node_modules/serverless-plugin-typescript/dist/src/index.js:7:71
      at new Promise (<anonymous>)
      at __awaiter (/Users/rye/scm/vendor/jp-dustyjewett-ts-issue/test/packages/monorepo/yarn/node_modules/serverless-plugin-typescript/dist/src/index.js:3:12)
      at TypeScriptPlugin.copyDependencies (/Users/rye/scm/vendor/jp-dustyjewett-ts-issue/test/packages/monorepo/yarn/node_modules/serverless-plugin-typescript/dist/src/index.js:166:16)
      at TypeScriptPlugin.<anonymous> (/Users/rye/scm/vendor/jp-dustyjewett-ts-issue/test/packages/monorepo/yarn/node_modules/serverless-plugin-typescript/src/index.ts:45:20)
      at Generator.next (<anonymous>)
      at fulfilled (/Users/rye/scm/vendor/jp-dustyjewett-ts-issue/test/packages/monorepo/yarn/node_modules/serverless-plugin-typescript/dist/src/index.js:4:58)
      at process._tickCallback (internal/process/next_tick.js:68:7)
  From previous event:
      at PluginManager.invoke (/Users/rye/scm/vendor/jp-dustyjewett-ts-issue/test/packages/monorepo/yarn/node_modules/serverless/lib/classes/PluginManager.js:489:22)
      at getHooks.reduce.then (/Users/rye/scm/vendor/jp-dustyjewett-ts-issue/test/packages/monorepo/yarn/node_modules/serverless/lib/classes/PluginManager.js:524:24)
  From previous event:
      at PluginManager.run (/Users/rye/scm/vendor/jp-dustyjewett-ts-issue/test/packages/monorepo/yarn/node_modules/serverless/lib/classes/PluginManager.js:524:8)
      at variables.populateService.then (/Users/rye/scm/vendor/jp-dustyjewett-ts-issue/test/packages/monorepo/yarn/node_modules/serverless/lib/Serverless.js:115:33)
      at runCallback (timers.js:705:18)
      at tryOnImmediate (timers.js:676:5)
      at processImmediate (timers.js:658:5)
      at process.topLevelDomainCallback (domain.js:126:23)
  From previous event:
      at Serverless.run (/Users/rye/scm/vendor/jp-dustyjewett-ts-issue/test/packages/monorepo/yarn/node_modules/serverless/lib/Serverless.js:102:74)
      at serverless.init.then (/Users/rye/scm/vendor/jp-dustyjewett-ts-issue/test/packages/monorepo/yarn/node_modules/serverless/bin/serverless.js:72:30)
      at /Users/rye/scm/vendor/jp-dustyjewett-ts-issue/test/packages/monorepo/yarn/node_modules/serverless/node_modules/fs-extra/node_modules/graceful-fs/graceful-fs.js:111:16
      at /Users/rye/scm/vendor/jp-dustyjewett-ts-issue/test/packages/monorepo/yarn/node_modules/serverless/node_modules/graceful-fs/graceful-fs.js:111:16
      at /Users/rye/scm/vendor/jp-dustyjewett-ts-issue/test/packages/monorepo/yarn/node_modules/serverless/node_modules/graceful-fs/graceful-fs.js:45:10
      at FSReqWrap.args [as oncomplete] (fs.js:140:20)
  From previous event:
      at initializeErrorReporter.then (/Users/rye/scm/vendor/jp-dustyjewett-ts-issue/test/packages/monorepo/yarn/node_modules/serverless/bin/serverless.js:72:8)
      at runCallback (timers.js:705:18)
      at tryOnImmediate (timers.js:676:5)
      at processImmediate (timers.js:658:5)
      at process.topLevelDomainCallback (domain.js:126:23)
  From previous event:
      at Object.<anonymous> (/Users/rye/scm/vendor/jp-dustyjewett-ts-issue/test/packages/monorepo/yarn/node_modules/serverless/bin/serverless.js:61:4)
      at Module._compile (internal/modules/cjs/loader.js:778:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
      at Module.load (internal/modules/cjs/loader.js:653:32)
      at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
      at Function.Module._load (internal/modules/cjs/loader.js:585:3)
      at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
      at startup (internal/bootstrap/node.js:283:19)
      at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com
 
  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              10.16.3
     Framework Version:         1.57.0
     Plugin Version:            3.2.4
     SDK Version:               2.2.1
     Components Core Version:   1.1.2
     Components CLI Version:    1.4.0

Let’s maybe have you turn to a minimal repository that produces the issue specific to jetpack so I can clone it, install, and follow your steps to a jetpack-specific error? Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fixing serverless typescript, Types of property 'event' are ...
I've upgraded to serverless 3, running typescript. There is a type match error in the serverless configuration files since.
Read more >
serverless-webpack - npm
A Serverless Framework plugin to build your lambda functions with Webpack. This plugin is for you if you want to use the latest...
Read more >
Serverless Sentry - Serverless Framework: Plugins
This Serverless plugin simplifies integration of Sentry with the popular Serverless Framework and AWS Lambda. Currently we support Lambda Runtimes for ...
Read more >
Serverless | Ts.ED - A Node.js and TypeScript Framework on ...
This Serverless plugin emulates AWS λ and API Gateway on your local machine to ... Declaring all routes in the serverless.yml file can...
Read more >
serverless-offline/community - Gitter
Hi! anyone have successfully used the latest plugin to run typescript apps? ... But I am facing some issue w/ testing using the...
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 Hackernoon Post

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