Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find module coa/compile.js

I'm running yarn in a project created with create-react-app, but I'm getting this error:

Exit code: 1
Command: start /B node compile.js & node compile.js
Arguments: 
Directory: uber-web/node_modules/coa
Output:
/bin/sh: 1: start: not found
internal/modules/cjs/loader.js:905
  throw err;
  ^

Error: Cannot find module 'uber-web/node_modules/coa/compile.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
    at internal/main/run_main_module.js:17:47 {

I've already uninstalled all the .lock and node_module folder, but it still doesn't work.

like image 971
THIAGO DE BONIS Avatar asked Nov 04 '21 13:11

THIAGO DE BONIS


People also ask

Can't find module compile JS?

If you are getting the "Cannot find module" error when trying to run a local file, make sure that the path you passed to the node command points to a file that exists. For example, if you run node src/index. js , make sure that the path src/index. js points to an existing file.

Can not find module npm?

To solve the error "Cannot find module 'express'", install the package by running the command npm install express in the root directory of your project. If you don't have a package. json file, create one by running npm init -y . The error occurs when we try to import the express package without installing it.


2 Answers

The problem is being addressed on the Github page of the coa package: https://github.com/veged/coa/issues/99

An attacker published a corrupted version of the package, do not install it especially if you are on Windows !

like image 137
user17328788 Avatar answered Oct 24 '22 07:10

user17328788


Update: NPM removed the malicious version and the latest version is 2.0.2 again. Everything should be back to normal.

As mentioned in the previous answer. It is due to a new release that is broken and malicious (confirmed).

As mentioned in https://github.com/veged/coa/issues/99:

Short-term fix šŸ¤• Use "[email protected]" specifically. 2.0.3. is the first update that broke things. šŸ¤•

Additionally as @herrwitzi suggests in the comments if you use yarn you can add a resolution to your package.json

"resolutions": { "coa": "2.0.2" },

Just add above line under your dependencies in package.json.

like image 2
Bekir Yenilmez Avatar answered Oct 24 '22 08:10

Bekir Yenilmez