简体   繁体   中英

Why do i get this npm Error: Cannot find module '/home/directory' from '/home/directory'

I have the following scripts in my package.json file

 "scripts": {
    "start": "watchify -o js/bundle.js -v -d ."
  }

When i run npm start inside /home/directory i get this error Error: Cannot find module '/home/directory' from '/home/directory'

My directory structure is like

-/home/directory
          --package.json
          -js/
             --script1.js
             --script2.js   

Why am i getting this error?

My guess is that you can pass multiple argument to watchify. Lets say you remove the flags, you should get something like "watchify js/bundle.js ." so watchify might be trying to run for both js/bundle.js and . (the last one pointing to your current dir which is home/directory )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM