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.

Clean build off master - Error: Cannot find module 'uglify-js'

See original GitHub issue

Your project looks like fun. I set it up using the command you have in the instructions.

cordova create <project_create_dir> [com.example.projectname] [ProjectClassName] --template cordova-template-framework7-vue-webpack

No errors. One warning that I think may be relevant is:

npm WARN uglifyjs-webpack-plugin@0.3.1 requires a peer of uglify-js@^2.8.0 but none was installed.

I then ran npm install

All good.

When I run webpack I get

Error: Cannot find module 'uglify-js'

So, I installed the Android platform cordova platform add android

All good.

Then I and ran cordova build android And I get

Error: Cannot find module 'uglify-js'

I checked node_modules\ and I found uglify-es, uglifyjs-webpack-plugin, uglify-to-browserify

Not sure about that uglify-es folder.

In the package.js file in dev it says,

        "uglify-js": "git://",
        "uglifyjs-webpack-plugin": "^0.3.0",

When I try to

npm install --save-dev uglify-js@github:mishoo/UglifyJS2#harmony

I now see a uglify-js folder in the node-modules folder, but I still get the same uglify-js not found error.

I’m on Linux and checked my $PATH for conflicting settings. No path specified for node_modules. That’s all good, no reference at all.

I haven’t installed uglify globally. That would probably solve the issue though it might make reference to the Harmony version difficult, breaking support for ES6 (I’m guessing?).

I’m new to webpack (previous gulp exp.) so maybe I’m using Webpack incorrectly or missing a step?

Running Node v 7.2.1 Cordova v 6.5.0 NPM v 3.10.10

Any advice appreciated. Thank you in advance.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

centrualcommented, May 10, 2017

Hello guys,

If you want to create issue on uglify-js git it displays these texts:

<!-- Note: for ES6 see: -->
    Note: `uglify-js` only supports ES5. 
    Those wishing to minify ES6 should use `uglify-es`.

They are changing the uglify js and these changes are not backward compatible. For ES6 uglify, you need to use uglify-es NOT uglify-js. uglify-js compiles ES5 only!

So since #harmony branch not compatible with v2.x we have 2 choices:

  1. We can install 2.8 harmony version of uglify js npm i --save-dev
  2. We can wait for compatibility of uglifyjs-webpack-plugin for new version of uglify js. You can track the changes from:

Note: I will update the dependency soon. You can update your dependencies yourself if you want with these commands:

npm rm uglify-js --save-dev
npm i --save-dev
strixycommented, May 9, 2017
npm install uglify-js@^2.8.0

Seems to help. Webpack runs without error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

uglify-js in nodeJS "Cannot find module" - Stack Overflow
When i try to run by "node server.js" in command prompt throwing error. Error : Cannot find module 'uglify-js'. Server.js var UglifyJS ......
Read more >
Jun 2017 - webpack/webpack - Gitter
html-webpack-plugin/lib/loader.js!./src/index.pug Module build failed: Error: Cannot find module 'pug'. Any ideas, what I'm doing wrong?
Read more >
node:internal/modules/cjs/loader:936 throw err -
This error comes due to the missing of the .next folder. Which can be created by a command. First of all, you go...
Read more >
Cannot find module fs - Caritas Castellaneta
ERROR in Cannot find module 'node-sass'. 5 hours . js (9. Set up a new Node. 内存不够了. - web3-solc-contract-compile-deploy. Out of the box,...
Read more >
How to Install npm, Master npm Commands & Use Packages
Node Package Manager Guide: Install npm + Use Commands & Modules ... It's built on the V8 JavaScript runtime and written in C++...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found