Node.js: Error: Cannot find module 'stack' - macos

I tried to install howtonode.org on my Osx
cd ~/Sites/
git clone git#github.com:creationix/howtonode.org
My context is the following:
OSx version: 10.7.4
node -v v0.6.15
When I try to run the following command
~/Sites/howtonode.org node server/server.js &
I get the following error:
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'stack'
at Function._resolveFilename (module.js:332:11)
at Function._load (module.js:279:25)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object.<anonymous> (/Users/antoniopierro/Sites/howtonode.org/server/server.js:2:13)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
at Function._load (module.js:308:12)
at Array.0 (module.js:479:10)
[1]+ Exit 1 node server/server.js
any ideas?

Try running node ~/Sites/howtonode.org/server/server.js & or go to ~/Sites/howtonode.org/server/ and runnode server
Also, you have not installed the dependencies from package.json.
Go to ~/Sites/howtonode.org/ and type inn npm install. This will install all the dependencies in ~/Sites/howtonode.org/node_modules. You can then run the server.

Related

Getting error when trying to run Ganache (forking BSC chain)

I have installed Ganache following instructions from https://github.com/trufflesuite/ganache#documentation
I am trying to fork BSC chain for which I have a node running locally which is fully synced (I want to fork this for which I have provided the URL in package.json under scripts).
When trying to run Ganache using npm run ganache it is giving me this error. Any idea how can I solve this?
SyntaxError: Unexpected token '?'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.__webpack_require__.f.require (/usr/local/lib/node_modules/ganache/dist/node/cli.js:2:21481)
at /usr/local/lib/node_modules/ganache/dist/node/cli.js:2:20777
at Array.reduce (<anonymous>)`
Supposedly it was supposed to run after this, so why i am getting this error?
Check your Node.js version:
node -v
v18.13.0
Version must be >= v14.0.0. After updating to the latest Node.js version, the error no longer occurred for me.

Unable to install Strapi - Cannot find module '../build/Release/sharp.node'

I'm unable to install strapi. When I run the quickstart, it gives an error about not being able to find "sharp".
I tried downgrading node - from 16.x.x to 14.18.1, and I get fewer warnings, but still threw the same error.
OS: Windows
Node: 14.18.1
NPM: 6.14.15
❯ npx create-strapi-app jeffsdata-cms --quickstart  401ms  user  
npx: installed 146 in 13.315s
Creating a quickstart project.
Creating a new Strapi application at C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms.
Creating files.
Dependencies installed successfully.
Your application was created at C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms.
Available commands in your project:
npm run develop
Start Strapi in watch mode.
npm run start
Start Strapi without watch mode.
npm run build
Build Strapi admin panel.
npm run strapi
Display all available commands.
You can start by doing:
cd C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms
npm run develop
> jeffsdata-cms#0.1.0 build
> strapi build "--no-optimization"
Building your admin UI with development configuration ...
√ Webpack
Compiled successfully in 34.99s
Running your Strapi application.
> jeffsdata-cms#0.1.0 develop
> strapi develop
[2021-11-26T15:48:12.185Z] debug ⛔️ Server wasn't able to start properly.
[2021-11-26T15:48:12.186Z] error Error:
Something went wrong installing the "sharp" module
Cannot find module '../build/Release/sharp.node'
Require stack:
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\sharp\lib\constructor.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\sharp\lib\index.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\strapi-plugin-upload\services\image-manipulation.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\strapi\lib\load\load-files.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\strapi\lib\core\load-apis.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\strapi\lib\core\load-modules.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\strapi\lib\Strapi.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\strapi\lib\index.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\strapi\lib\commands\develop.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\strapi\bin\strapi.js
- Remove the "node_modules/sharp" directory then run
"npm install --ignore-scripts=false --verbose sharp" and look for errors
- Consult the installation documentation at https://sharp.pixelplumbing.com/install
- Search for this error at https://github.com/lovell/sharp/issues
at Object.<anonymous> (C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\sharp\lib\constructor.js:32:9)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Object.<anonymous> (C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\sharp\lib\index.js:3:15)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
I tried to delete the sharp folder and reinstall while on node 16, but that didn't fix this issue.
I tried to reinstall sharp on 14.18.1, but got a different error.
Downgrade node to 14.18.1 (windows: control panel, remove node, then download 14.18.1 (or whatever the most recent one, if it upgrades) from here).
Run the quickstart command npx create-strapi-app jeffsdata-cms --quickstart
Still throws the error complaining about sharp.
Delete the npm_modules/sharp folder
Reinstall sharp with npm install --ignore-scripts=false --verbose sharp.
Confirm it's working with node run develop.
This didn't fix the issue for me - now it just throws another error:
❯ node run develop  1m 34.989s  user  
internal/modules/cjs/loader.js:905
throw err;
^
Error: Cannot find module 'C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\run'
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 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
I next tried to roll back to Node 16 and use the beta...
Uninstall Node 14
Install Node 16
Install strapi beta - npm install strapi#beta -g
Create new project: strapi new jeffsdata-cms --quickstart
Now I get this error...
❯ strapi develop
 4.469s  user  
[2021-11-26T16:58:19.646Z] error The client `sqlite3` is not installed.
[2021-11-26T16:58:19.647Z] error You can install it with `$ npm install sqlite3 --save`.
So, I obviously install sqlite3 - npm install sqlite3 --save, but it doesn't change the error.
So, I try running strapi build, then strapi develop... Same error - "The client sqlite3 is not installed."

Error when run substrate-front-end-template$ yarn install

I have been following the instruction to Install the Front-end template , error when I run substrate-front-end-template$ yarn install.The error is following:
Error: Cannot find module 'worker_threads'
## Heading ##at Function.Module._resolveFilename (internal/modules cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at /home/erichuang2005/substrate-node-template/substrate-front-end-template/.yarn/releases/yarn-berry.cjs:289:2658
I'm not sure about your exact error message but I also had a problem with yarn install which was solved by using a different version of node. I had a problem with version 17. Version 16 worked for me.

Cordova 4.3.0 - build command returns error Cannot find module 'Q'

After updating cordova to version 4.3.0 the command:
cordova build
returns the following error:
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> (/Volumes/CaseSensitive/ios_projects/_Tests/testGruntCordova/testGruntCordova/platforms/ios/cordova/lib/check_reqs.js:25:13)
at Module._compile (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 Module.require (module.js:364:17)
ERROR building one of the platforms: Error: /Volumes/CaseSensitive/ios_projects/_Tests/testGruntCordova/testGruntCordova/platforms/ios/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: /Volumes/CaseSensitive/ios_projects/_Tests/testGruntCordova/testGruntCordova/platforms/ios/cordova/build: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)
I have already tried to remove and add the platform ios but nothing changes.
I have tried to run:
sudo npm install -g cordova / sudo npm install cordova
sudo npm install -g Q / sudo npm install Q
but nothing changes.
Any help?
Thank you very much
There was a bug and I have released a patch to it:
Apache Cordova ios - Git Repository
This is a bug shown on case-sensitive systems such as Unix, Linux and some OS X (if set as case-sensitive).
So far, to fix it, you have to locate those files containing a line like this:
Q = require('Q')
You can locate the files while standing on your project directory using grep:
grep -HnrI "require('Q" *;
then, use any text editor to manually change the mentioned line to:
Q = require('q')
Alternatively you can edit the related files on a more straight forward way by running the following command on your project directory:
grep -rl "require('Q" * | xargs sed -i "" "s/'Q'/'q'/g";
The single line above searches and edits the files that need the change.
Removing and then re-adding the platform again also works:
cordova platform remove ios
cordova platform add ios
Now you can cordova build ios :)
As mentioned by MeV this was a bug.

Why am I getting errors running the coffee command in cygwin?

I followed the CoffeeScript installation guide by installing Node.js with the node-v0.10.9-x64.msi installer. I then started up a cygwin console and cd'd into the directory with my .coffee file. If I type coffee all by itself, it gives me this error:
$ coffee
coffee>
events.js:72
throw er; // Unhandled 'error' event
^
Error: read ENOTCONN
at errnoException (net.js:884:11)
at Socket._read (net.js:389:21)
at Socket.Readable.read (_stream_readable.js:320:10)
at Socket.read (net.js:291:43)
at new Socket (net.js:185:10)
at process.stdin (node.js:660:19)
at new REPLServer (repl.js:132:15)
at Object.exports.start (repl.js:312:14)
at Object.module.exports.start (C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\repl.js:106:23)
at Object.exports.run (C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:77:32)
at Object.<anonymous> (C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\bin\coffee:7:41)
at Module._compile (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)
at startup (node.js:119:16)
at node.js:901:3
And if I run the command with -lw it gives me this error:
$ coffee -lw Example.js.coffee
Error: This socket is closed.
at Socket._write (net.js:618:19)
at doWrite (_stream_writable.js:219:10)
at writeOrBuffer (_stream_writable.js:209:5)
at Socket.Writable.write (_stream_writable.js:180:11)
at Socket.write (net.js:596:40)
at lint (C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:468:15)
at compileScript (C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:193:18)
at C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:144:18
at fs.js:266:14
at Object.oncomplete (fs.js:107:15)
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)
And if I run with just the -l option it gives me this error:
$ coffee -l Example.coffee
Error: This socket is closed.
at Socket._write (net.js:618:19)
at doWrite (_stream_writable.js:219:10)
at writeOrBuffer (_stream_writable.js:209:5)
at Socket.Writable.write (_stream_writable.js:180:11)
at Socket.write (net.js:596:40)
at lint (C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:468:15)
at compileScript (C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:193:18)
at C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:144:18
at fs.js:266:14
at Object.oncomplete (fs.js:107:15)
But it seems like I can compile and/or watch option without the lint option and things work as expected.
I don't know anything about Node.js. I've tried googling these errors and I see similar ones related to ports in use and socket issues. I think it might be useful to note that I'm using Intellij IDEA (an IDE) and it has a CoffeeScript plugin which perhaps is interfering. But when I turn Intellij off I still get these same errors so that might be a red herring.
Also, perhaps there's a specific cygwin version of node.js I should have installed instead of the one I got from the installation instructions?
If I type node all by itself, it says this:
$ node
events.js:72
throw er; // Unhandled 'error' event
^
Error: read ENOTCONN
at errnoException (net.js:884:11)
at Socket._read (net.js:389:21)
at Socket.Readable.read (_stream_readable.js:320:10)
at Socket.read (net.js:291:43)
at new Socket (net.js:185:10)
at process.stdin (node.js:660:19)
at startup (node.js:145:16)
at node.js:901:3
Unfortunately, node no longer supports Cygwin.
One workaround is to use some variety of MSysGit as a console instead of Cygwin, at least for running node/coffeescript. Git Bash supplies a good one. You can get it here.

Resources