Sls deploy cmd getting failed anyone noticed this issue

Server less Framework : version 2
Node Version :14
OS : Windows 10

internal/modules/cjs/loader.js:888
throw err;
^

Error: Cannot find module ‘C:\Users\AppData\Roaming\npm\node_modules\serverless\bin\serverless.js’
←[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)←[39m
←[90m at Function.Module._load (internal/modules/cjs/loader.js:730:27)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)←[39m
←[90m at internal/main/run_main_module.js:17:47←[39m {
code: ←[32m’MODULE_NOT_FOUND’←[39m,
requireStack: []
}

I have fixed sls deploy (serverless deploy ) Issue

Issue:

internal/modules/cjs/loader.js:888
throw err;
^

Error: Cannot find module ‘C:\Users\AppData\Roaming\npm\node_modules\serverless\bin\serverless.js’
←[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)←[39m
←[90m at Function.Module._load (internal/modules/cjs/loader.js:730:27)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)←[39m
←[90m at internal/main/run_main_module.js:17:47←[39m {
code: ←[32m’MODULE_NOT_FOUND’←[39m,
requireStack: []
}

=========================================================================
Windows Operating System:

Solution:

Step 1 : Go to file explorer.
Step 2 : Find the top file explorer 4th option (View).
Step 3 : Click the View option and Tick the Hidden items :ballot_box_with_check:
Step 4: Go to this file path ( C:\Users"your user name"\AppData\Roaming\npm).
Step 5. Find these files given below
* serverless
* serverless
* serverless
* sls
* sls
* sls
Step 6 : Delete these above 6 files (file types: cmd, powershell, document,etc,)
Step 7 : then install freshly serverless framework ( npm install -g serverless )
Step 8 : Successfully fixed you’re issue.

========================================================================
If you have any doubt feel free to ping me. I’m here to help you… :handshake:

Happy Coding…!

thanks for the awesome information.

1 Like