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 report: Errors during grunt dev and grunt prod #575

Closed
farewell-ladmin opened this issue Jun 13, 2019 · 3 comments
Closed

Bug report: Errors during grunt dev and grunt prod #575

farewell-ladmin opened this issue Jun 13, 2019 · 3 comments

Comments

@farewell-ladmin
Copy link

Summary

I am attempting to use the latest version of CyberChef on Ubuntu 18.04. When I run grunt dev I get an error during the Regenerating Config Files section. I also get an error when attempting to view the webpage after grunt dev finishes. Similar errors happen during grunt prod

I am using NodeJS v12.4.0 and npm v6.9.0

Example

Error during grunt dev

Running "exec:generateConfig" (exec) task

--- Regenerating config files. ---
Written operation index.
>> internal/modules/esm/default_resolve.js:59
>>   let url = moduleWrapResolve(specifier, parentURL);
>>             ^
>>
>> Error: Cannot find module '/opt/CyberChef/src/core/operations/index' imported from /opt/CyberChef/src/core/config/scripts/generateConfig.mjs
>>     at Loader.resolve [as _resolve] (internal/modules/esm/default_resolve.js:59:13)
>>     at Loader.resolve (internal/modules/esm/loader.js:70:33)
>>     at Loader.getModuleJob (internal/modules/esm/loader.js:143:40)
>>     at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:43:40)
>>     at link (internal/modules/esm/module_job.js:42:36) {
>>   code: 'ERR_MODULE_NOT_FOUND'
>> }
--- Config scripts finished. ---

At the end of grunt dev I get
ℹ 「wdm」: Failed to compile.

I can visit the webserver running at 8080 but I get the following error:

Error: Cannot find module './config/modules/OpModules'
Filename: blob:http://134.209.212.83:8080/bf99977c-08a9-634b-952f-1da2ce328e40 line 271 > eval
Line: 9
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:67.0) Gecko/20100101 Firefox/67.0
CyberChef version: 8.31.5

grunt prod errors:

Running "eslint:configs" (eslint) task

Running "eslint:core" (eslint) task

Running "eslint:web" (eslint) task

Running "eslint:node" (eslint) task

Running "eslint:tests" (eslint) task

Running "clean:prod" (clean) task
>> 1 path cleaned.

Running "clean:config" (clean) task
>> 1 path cleaned.

Running "exec:generateConfig" (exec) task

--- Regenerating config files. ---
Written operation index.
>> internal/modules/esm/default_resolve.js:59
>>   let url = moduleWrapResolve(specifier, parentURL);
>>             ^
>>
>> Error: Cannot find module '/opt/CyberChef/src/core/operations/index' imported from /opt/CyberChef/src/core/config/scripts/generateConfig.mjs
>>     at Loader.resolve [as _resolve] (internal/modules/esm/default_resolve.js:59:13)
>>     at Loader.resolve (internal/modules/esm/loader.js:70:33)
>>     at Loader.getModuleJob (internal/modules/esm/loader.js:143:40)
>>     at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:43:40)
>>     at link (internal/modules/esm/module_job.js:42:36) {
>>   code: 'ERR_MODULE_NOT_FOUND'
>> }
--- Config scripts finished. ---


Running "webpack:web" (webpack) task
 94% after sealError parsing bundle asset "/opt/CyberChef/build/prod/assets/main.js": no such file
Error parsing bundle asset "/opt/CyberChef/build/prod/sitemap.js": no such file

No bundles were parsed. Analyzer will show only original module sizes from stats file.

Webpack Bundle Analyzer saved report to /opt/CyberChef/build/prod/BundleAnalyzerReport.html
Hash: f84b45cc2b1d8c39528a
Version: webpack 4.31.0
Time: 21681ms
Built at: 06/13/2019 6:07:08 PM
 10 assets
Warning:  Use --force to continue.

Aborted due to warnings.
@farewell-ladmin
Copy link
Author

Figured it out. Looks like it fails on NodeJS v12.4.0 and npm v6.9.0

I downgraded to v11.15.0 and I can get it to work. Closing the issue

@FrancoisDuchene
Copy link

Got the same issue. Don't forget to clear your node_module folder and run npm install again.
I also used this script to use the older version, if that can help someone out there, check it out

@jiri-jagos
Copy link

This one bit me too. In order to build the CyberChef on a recent Debian GNU linux I made this:

# as a normal user (NOT root)
# Install the **latest LTS version 10 of Node.js** and its package manager, npm using the 'nvm' tool: 
# - see https://linuxize.com/post/how-to-install-node-js-on-debian-10/#installing-nodejs-and-npm-using-nvm
# '!!!IMPORTANT!!! the build is fully suported on the nodejs 10.* LTS version as stated here: https://github.com/gchq/CyberChef#nodejs-support

# then clone the CyberChef github repository
git clone https://github.com/gchq/CyberChef.git

# Change to the cloned CyberChef directory
cd CyberChef

# Install nodejs modules
npm install
# !!!IMPORTANT!!! - do NOT try to fix reported vulnerabilities and obsolete modules with 'npm audit fix' or the build will be broken

# After all dependencies are installed run production build with grunt
time ./node_modules/grunt/bin/grunt prod --force

# Oneliner for build cloned repository which must be run in the CyberChef root folder:
rm -fr ./build ./node_modules package-lock.json && git checkout . && npm install && time ./node_modules/grunt/bin/grunt prod --force

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

3 participants