最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Node error: Cannot find module '.clone.js' - Stack Overflow

programmeradmin0浏览0评论

I'm working on app using node and postgresql. Recently I updated nodemon and started getting an error when I start my nodemon server: Cannot find module './clone.js'. Here is the code of the error:

Error: Cannot find module './clone.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
    at Function.Module._load (internal/modules/cjs/loader.js:506:25)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/nodemon/node_modules/graceful-fs/graceful-fs.js:4:13)
    at Module._pile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)

I checked that on Github and it said that this is recent bug and it was supposed to be fixed with next update. I waited until the update but still had the same error. I reinstalled nodemon, removed node_modules and did npm install. Somebody in Github issue page was suggesting to put clone.js in files array which is fine already. graceful-fs.js starts with code:

var fs = require('fs')
var polyfills = require('./polyfills.js')
var legacy = require('./legacy-streams.js')
var clone = require('./clone.js')

In the same folder there is already file clone.js with content, so now I'm really confused. Please help

I'm working on app using node and postgresql. Recently I updated nodemon and started getting an error when I start my nodemon server: Cannot find module './clone.js'. Here is the code of the error:

Error: Cannot find module './clone.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
    at Function.Module._load (internal/modules/cjs/loader.js:506:25)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/nodemon/node_modules/graceful-fs/graceful-fs.js:4:13)
    at Module._pile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)

I checked that on Github and it said that this is recent bug and it was supposed to be fixed with next update. I waited until the update but still had the same error. I reinstalled nodemon, removed node_modules and did npm install. Somebody in Github issue page was suggesting to put clone.js in files array which is fine already. graceful-fs.js starts with code:

var fs = require('fs')
var polyfills = require('./polyfills.js')
var legacy = require('./legacy-streams.js')
var clone = require('./clone.js')

In the same folder there is already file clone.js with content, so now I'm really confused. Please help

Share Improve this question edited Nov 10, 2018 at 6:59 in43sh asked Nov 10, 2018 at 6:55 in43shin43sh 9632 gold badges14 silver badges37 bronze badges 9
  • can you give us your file structure ? – Daksh M. Commented Nov 10, 2018 at 6:56
  • @DakshMiglani should I do the screenshot? – in43sh Commented Nov 10, 2018 at 6:58
  • Sure. should work. – Daksh M. Commented Nov 10, 2018 at 6:59
  • yeah, so it's justified there's no clone.js file in the server directory. – Daksh M. Commented Nov 10, 2018 at 7:03
  • 1 U need to add the global flag, ie. npm i -g [email protected] – Sello Mkantjwa Commented Nov 10, 2018 at 13:55
 |  Show 4 more ments

2 Answers 2

Reset to default 5

I faced the same issue and I resolved my issue by running below mand.

rm -rf node_modules

npm install

As somebody mentioned in the ment, I had to update it globally. So that's what I did to fix it:

npm uninstall -g nodemon

npm install -g nodemon

And then it worked!

发布评论

评论列表(0)

  1. 暂无评论