Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG - ./edit command fails - throwing error - cannot find module 'stylus' #84

Open
jonnathan-ls opened this issue Jun 10, 2022 · 0 comments

Comments

@jonnathan-ls
Copy link
Contributor

jonnathan-ls commented Jun 10, 2022

🐞 Bug

Cannot find module 'stylus'

🎯 Context

Execution of server project locally to test site translation initiative

💣 Problem

After cloning the repositories (serve and module and repo) and installing the dependencies, the attempt to execute the command ./edit to load the application ends up failing, as shown in the following log:

♨️  server git:(master) ./edit pt 
[23:39:06] Using gulpfile ~/Desktop/desktop/javascript-info/server/gulpfile.js
[23:39:06] Starting 'edit'...
[23:39:06] Starting 'webpack'...
[23:39:06] Starting 'engine:koa:tutorial:importWatch'...
[23:39:06] Starting 'livereload'...
[23:39:06] Starting 'server'...
Livereload server listening
02:39:08.710Z  INFO application: Boot complete
[23:39:08] 'webpack' errored after 2.6 s
[23:39:08] Error: Cannot find module 'stylus'
Require stack:
- /Users/t719516/Desktop/desktop/javascript-info/server/node_modules/nib/lib/nib.js
- /Users/t719516/Desktop/desktop/javascript-info/server/modules/config/webpack.js
- /Users/t719516/Desktop/desktop/javascript-info/server/modules/config/index.js
- /Users/t719516/Desktop/desktop/javascript-info/server/gulpfile.js
- /Users/t719516/Desktop/desktop/javascript-info/server/node_modules/gulp/node_modules/gulp-cli/lib/shared/require-or-import.js
- /Users/t719516/Desktop/desktop/javascript-info/server/node_modules/gulp/node_modules/gulp-cli/lib/versioned/^4.0.0/index.js
- /Users/t719516/Desktop/desktop/javascript-info/server/node_modules/gulp/node_modules/gulp-cli/index.js
- /Users/t719516/Desktop/desktop/javascript-info/server/node_modules/gulp/bin/gulp.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users/t719516/Desktop/desktop/javascript-info/server/node_modules/nib/lib/nib.js:11:14)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
[23:39:08] 'edit' errored after 2.6 s

🔍 Reason

The problem is due to the fact that two project libs (nib and stylus-loader) depend on the stylus library, as NPM warns right after installing the dependencies:

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN nib@1.2.0 requires a peer of stylus@* but none is installed. You must install peer dependencies yourself.
npm WARN stylus-loader@3.0.2 requires a peer of stylus@>=0.52.4 but none is installed. You must install peer dependencies yourself.

added 1471 packages from 894 contributors and audited 1475 packages in 392.365s

68 packages are looking for funding
  run `npm fund` for details

found 47 vulnerabilities (37 moderate, 10 high)
  run `npm audit fix` to fix them, or `npm audit` for details

✅ Expected

Execution of the command, without any failure.

🛠️ Solution

Installing the stylusdependency solved the problem.

♨️  server git:(master) npm i stylus
npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
+ stylus@0.58.1
added 7 packages from 42 contributors and audited 1482 packages in 10.004s

68 packages are looking for funding
  run `npm fund` for details

found 47 vulnerabilities (37 moderate, 10 high)
  run `npm audit fix` to fix them, or `npm audit` for details
  
♨️  server git:(master) ✗ ./edit en                                                          
[23:53:35] Using gulpfile ~/Desktop/desktop/javascript-info/server/gulpfile.js
[23:53:35] Starting 'edit'...
... LOG OMITTED ...
02:54:02.426Z  INFO importWatch: Import complete

🌍 Environmentl

  • Node: 14.16.1
  • Npm: 6.14.12

🗳️ Suggestion

Add a dependency on the project's package.json.

🏷️ Labels

~Bug ~Dependencies ~Install ~Server

@jonnathan-ls jonnathan-ls changed the title BUG: "./edit" command fails: throwing error: cannot find module 'stylus' BUG - ./edit command fails - throwing error - cannot find module 'stylus' Jun 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant