fork-ts-checker-webpack-plugin: Webpack fails with "Cannot find module /home/USER/PROJECT/--max-old-space-size=2048"
Current behavior
Using the Serverless framework with Webpack. I type in sls deploy
, which bundles my application with webpack, and I get:
Serverless: Bundling with Webpack...
Starting type checking service...
internal/modules/cjs/loader.js:983
throw err;
^
Error: Cannot find module '/home/USER/PROJECT/--max-old-space-size=2048'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
at Function.Module._resolveFilename (pkg/prelude/bootstrap.js:1346:46)
at Function.Module._load (internal/modules/cjs/loader.js:862:27)
at Function.Module.runMain (pkg/prelude/bootstrap.js:1375:12)
at internal/main/run_main_module.js:18:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Disabling the plugin in my webpack.config.js
removes the problem
Expected behavior
Application would build successfully
Steps to reproduce the issue
In webpack.config.js
, have the following under “plugins”:
new ForkTsCheckerWebpackPlugin({
eslint: true,
eslintOptions: {
cache: true
}
})
Issue reproduction repository
https://github.com/PopeFelix/typescript-serverless
Environment
- fork-ts-checker-webpack-plugin: ^4.1.3
- typescript: 3.2.4
- eslint: 6.8.0
- webpack: 4.29.0
- os: Ubuntu 18.04.2
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 2
- Comments: 39
Had the exact same issue all of a sudden.
I was using
serverless-bundle
and used the following to fix it:as per https://www.npmjs.com/package/serverless-bundle
My serverless is added as a devDependency
also had to set memory limit to 4gb (memory hog nodejs)
I don’t have too much helpful to add here, but I am running into the same issue (new to serveless, webpack, etc. - following https://github.com/mtimbs/typescript-serverless and tracing the bug down to here) on macOS.
I have tracked down this line as a place where I can alter the behavior (i.e. by changing the memory limit the log changes its value). https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/blob/5ba683960e871d387685379d5a78943e4a5dc679/src/rpc/rpc-ipc/RpcIpcMessagePort.ts#L112
This gets packaged up as
Looks very similar to https://github.com/vercel/pkg/issues/909.
I have experienced the same thing, there were conflicting versions of serverless installed in two different locations. to figure out if you have the same issue run
whereis serverless
, if you are using nvm, remove the other one (~/.serverless/bin).hmm… the comment that you cite is not correct, because
RpcIpcMessagePort.ts
file is from version >= 5, butis a code from version 4. If serverless framework messes up with exec arguments, then I think it should be fixed there - not in this plugin. And based on the comments, it seems that the issue was fixed in newer versions of serverless so I would suggest upgrading 😃
Does not work for me even with local
sls
execution. I’m also usingserverless-bundle
Installing Serverless Framework via
yarn global add serverless
fixed the problem for me.I had installed standalone on macOS. Moving to the npm version fixed this for me as well.
Had the same issue using standalone serverless binaries(1.80.0) and serverless-bundle(^3.0.0 using fork-ts-checker-webpack-plugin: ^4.0.1 ). Based on @hixus 's comment, I uninstalled the standalone version (originally installed via choco) and switched to the npm package
npm install serverless -g
and sure enough, that fixed it.I have the same issue with global
sls package
. Although if I putsls
as npm script and runnpm run sls -- package
there are no errors. Difference is:sls --version Framework Core: 1.78.1 (standalone) Plugin: 3.7.0 SDK: 2.3.1 Components: 2.33.4
npm run sls – --version
Framework Core: 1.78.1 Plugin: 3.7.0 SDK: 2.3.1 Components: 2.34.1
If I try to update the global one it still says “Serverless: Already at latest version” even though the local Components are newer