admin管理员组

文章数量:1315792

There is a production version of Ghost blogging platform with content and style changes on our server. I downloaded the blog's app folder to my local machine. The instructions seem straight forward.

Quickstart:
  1. npm install -g grunt-cli
  2. npm install
  3. grunt init (and grunt prod if you want to run Ghost in production mode)
  4. npm start

But when I run grunt init I get the following:

Running "shell:bower" (shell) task

module.js:340
    throw err;
      ^
Error: Cannot find module 'q'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/steelcollar/workspace/blog/node_modules/.bin/bower:6:9)
at Module._pile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
Warning: Command failed:
module.js:340
    throw err;
      ^
Error: Cannot find module 'q'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/steelcollar/workspace/blog/node_modules/.bin/bower:6:9)
at Module._pile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
Use --force to continue.

Eventually, running npm start leads to:

ERROR: Cannot find module '../node_modules/sqlite3/lib/binding/node-v11-darwin-x64/node_sqlite3.node'

I have bower and grunt installed. I haven't changed the code at all. Where could the problem be?

Update:

According to the folder structure I downloaded, the path is ../node-v11-linux-x64/node_sqlite3.node' instead of ../node-v11-darwin-x64/node_sqlite3.node'.

I am receiving this error if I change the folder name from darwin to linux though:

ERROR: dlopen(../node_modules/sqlite3/lib/binding/node-v11-darwin-x64/node_sqlite3.node, 1): no suitable image found.  Did find:
../node_modules/sqlite3/lib/binding/node-v11-darwin-x64/node_sqlite3.node: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00

There is a production version of Ghost blogging platform with content and style changes on our server. I downloaded the blog's app folder to my local machine. The instructions seem straight forward.

Quickstart:
  1. npm install -g grunt-cli
  2. npm install
  3. grunt init (and grunt prod if you want to run Ghost in production mode)
  4. npm start

But when I run grunt init I get the following:

Running "shell:bower" (shell) task

module.js:340
    throw err;
      ^
Error: Cannot find module 'q'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/steelcollar/workspace/blog/node_modules/.bin/bower:6:9)
at Module._pile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
Warning: Command failed:
module.js:340
    throw err;
      ^
Error: Cannot find module 'q'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/steelcollar/workspace/blog/node_modules/.bin/bower:6:9)
at Module._pile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
Use --force to continue.

Eventually, running npm start leads to:

ERROR: Cannot find module '../node_modules/sqlite3/lib/binding/node-v11-darwin-x64/node_sqlite3.node'

I have bower and grunt installed. I haven't changed the code at all. Where could the problem be?

Update:

According to the folder structure I downloaded, the path is ../node-v11-linux-x64/node_sqlite3.node' instead of ../node-v11-darwin-x64/node_sqlite3.node'.

I am receiving this error if I change the folder name from darwin to linux though:

ERROR: dlopen(../node_modules/sqlite3/lib/binding/node-v11-darwin-x64/node_sqlite3.node, 1): no suitable image found.  Did find:
../node_modules/sqlite3/lib/binding/node-v11-darwin-x64/node_sqlite3.node: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
Share Improve this question edited Oct 15, 2014 at 7:26 user1584575 asked Oct 15, 2014 at 6:49 user1584575user1584575 7413 gold badges10 silver badges20 bronze badges 3
  • Are you running this on Linux or OSX? – loganfsmyth Commented Oct 15, 2014 at 16:36
  • I am running this on OSX. – user1584575 Commented Oct 15, 2014 at 18:54
  • It sounds like for some reason, it installed and piled the binary for Linux instead of OSX. I have no idea why it would have done that though. – loganfsmyth Commented Oct 15, 2014 at 20:50
Add a ment  | 

3 Answers 3

Reset to default 6

Hi I had the same situation and this is how I solved it:

On the local puter, simply npm uninstall sqlite3 and npm install sqlite3 --save, and it should work normally now.

I'm not sure why it's like this. But I think it's because the versions of sqlite3 each OS requires are different, simply downloading the app directory from server to local puter will result in inpatibility issue, so just let npm decide which version of sqlite3 to install.

I got the same error. This didn't work:

yarn remove sqlite3 && yarn add sqlite3

Then I tried this, which did:

npm uninstall sqlite3 && npm install sqlite3

The correct answer to this would be to run npm rebuild. This will rebuild all the bindings relevant to the current project, especially after updates.

本文标签: javascriptERROR Cannot find module 39nodev11darwinx64nodesqlite3node39Stack Overflow