I have an issue while deploying my nodejs app on dotCloud regarding the dependencies. This app use node-canvas (https://github.com/LearnBoost/node-canvas) to generate a thumbnail of the sheet music (related to the music sheets available on jellynote.com).
I don't have any error during the push of my application and the installation of the dependencies. Here is my package.json file:
{
"name": "jellyscore",
"version": "1.0.0",
"dependencies": {
"canvas": "",
"mongodb": ""
}
}
and here is the logs that dotCloud return (edited log):
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module '../build/default/canvas'
at Function._resolveFilename (module.js:326:11)
at Function._load (module.js:271:25)
at require (module.js:355:19)
at Object.<anonymous> (/home/dotcloud/node_modules/canvas/lib/bindings.js:7:20)
at Module._compile (module.js:411:26)
at Object..js (module.js:417:10)
at Module.load (module.js:343:31)
at Function._load (module.js:302:12)
at require (module.js:355:19)
at Object.<anonymous> (/home/dotcloud/node_modules/canvas/lib/canvas.js:12:14)
Thanks!
Have you added CAIRO as system dependency ?
in you dotCloud yml:
systempackages:
- libcairo2
So if you have a Node.js only app it should look like this:
www:
type: nodejs
systempackages:
- libcairo2
Related
`PS C:\Users\Adrien\Documents\ReactNativeProjects> npx react-native start
node:internal/modules/cjs/loader:1042
throw err;
^
Error: Cannot find module 'graceful-fs'
Require stack:
- C:\Users\Adrien\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#react-native-community\cli\build\tools\gracefulifyFs.js
- C:\Users\Adrien\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#react-native-community\cli\build\bin.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
at Module._load (node:internal/modules/cjs/loader:885:27)
at Module.require (node:internal/modules/cjs/loader:1105:19)
at require (node:internal/modules/cjs/helpers:103:18)
at _gracefulFs (C:\Users\Adrien\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#react-native-community\cli\build\tools\gracefulifyFs.js:15:39)
at Object.<anonymous> (C:\Users\Adrien\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#react-native-community\cli\build\tools\gracefulifyFs.js:22:1) at Module._compile (node:internal/modules/cjs/loader:1218:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
at Module.load (node:internal/modules/cjs/loader:1081:32)
at Module._load (node:internal/modules/cjs/loader:922:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\Adrien\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\#react-native-community\\cli\\build\\tools\\gracefulifyFs.js',
'C:\\Users\\Adrien\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\#react-native-community\\cli\\build\\bin.js'
]
}
Node.js v18.13.0
Everytime I tried to create an App I got this as a response.
I tried to Open a Project like,
npx react-native init App2
I was expecting was for the project to get built, appear so that I could see all the project files.
I tried uninstalling and then reinstalling like,
npm install 'graceful-fs'
I tried the other solutions here too like apt-get or sudo and curl but it didn't work in my terminal`
I am building a Node.js Google Cloud function, and it is not recognizing the dependency "papaparse":
in package.json
"dependencies": {
"papaparse": "^5.0.0",
"twilio": "^3.33.2"
}
Error code I am getting:
Function failed on loading user code. Error message: Code in file index.js can't be loaded.
Did you list all required modules in the package.json dependencies?
Detailed stack trace: Error: Cannot find module 'papaparse'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/srv/index.js:8:14)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
I have tried reinstalling papaparse, running npm audit, but those steps haven't helped.
Does anyone know why this would happen?
I just managed to deploy a Cloud Function with papaparse.
For this you just need to deploy your function from the Cloud Shell. First create a folder where you gonna insert all your files. Then clone the repo from the papaparse github with the command git clone into that folder.
Now after adding your Index.json and your Package.json you can deploy your Cloud Function following this Deploying from Your Local Machine documentation.
I'm developing this project with TypeScript: https://github.com/scott-lin/install-npm-version
When trying to consume the package within another project, I'm getting Cannot find module 'install-npm-version' error.
Repro Steps
npm install install-npm-version#1.0.2
Create repro.js file with const inv = require('install-npm-version'); as the content
Invoke the repro with node .\repro.js
Error
> node .\repro.js
module.js:545
throw err;
^
Error: Cannot find module 'install-npm-version'
at Function.Module._resolveFilename (module.js:543:15)
at Function.Module._load (module.js:470:25)
at Module.require (module.js:593:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\scottlin.REDMOND\Desktop\test\repro.js:1:75)
at Module._compile (module.js:649:30)
at Object.Module._extensions..js (module.js:660:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
at Function.Module._load (module.js:493:3)
PS C:\Users\scottlin.REDMOND\Desktop\test>
The main property in the package.json file is used to find the module when using as an in-code Node module. Yours starts with a slash, implying the root directory. This is incorrect, which is why your code is failing.
To fix:
Change
"main": "/lib/Install.js",
to
"main": "lib/Install.js",
I can't seem to figure out why this works locally fine, but when I push it to Heroku it fails with the following error.
Error from Heroku
Starting process with command `node web.js`
module.js:337
throw new Error("Cannot find module '" + request + "'");
^
Error: Cannot find module './proto'
at Function._resolveFilename (module.js:337:11)
at Function._load (module.js:279:25)
at Module.require (module.js:359:17)
at require (module.js:375:17)
at Object.<anonymous> (/app/node_modules/express/node_modules/connect/lib/connect.js:14:13)
at Module._compile (module.js:446:26)
at Object..js (module.js:464:10)
at Module.load (module.js:353:31)
at Function._load (module.js:311:12)
at Module.require (module.js:359:17)
Process exited with status 1
State changed from starting to crashed
package.json
{
"name": "divtest",
"version": "0.0.2",
"dependencies": {
"underscore": "1.3.x",
"crypto": "0.0.x",
"knox": "0.3.x",
"mongoose": "~3.1.2",
"mime": "1.2.x",
"express": "3.0.x",
"request": "~2.9.203"
},
"engines": {
"node": "0.6.x",
"npm": "1.0.x"
}
}
./proto is a local module that connect is calling
I've blown away my ./node_modules folder and did a npm install --save and still get the same results.
I had this issue, and my problem was that I'm a git beginner and hadn't properly committed all of the files that were needed. It looks like there was a proto.js in connect somewhere.
I did a git add * (...) and pushed again and it all went nicely.
Another telling error, was that on push Heroku complained about unmet dependencies.
I want to try this module https://github.com/creationix/nstore fore simple storage .
But when i run this code :
// Load the library
var nStore = require('nstore');
// Create a store
var users = nStore.new('data/users.db', function () {
// It's loaded now
});
It gives me this error .
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'pattern'
at Function._resolveFilename (module.js:326:11)
at Function._load (module.js:271:25)
at require (module.js:355:19)
at Object.<anonymous> (/var/www/rahulutils/node_modules/nstore/nstore.js:4:15)
at Module._compile (module.js:411:26)
at Object..js (module.js:417:10)
at Module.load (module.js:343:31)
at Function._load (module.js:302:12)
at require (module.js:355:19)
at Object.<anonymous> (/var/www/rahulutils/testnstore.js:2:14)
where can i find this pattern module.
OR
any other simple key value database i can use pls suggest.
nstore usess 'pattern' package from NPM.
look at "dependencies":
https://github.com/creationix/nstore/blob/master/package.json
It should install with nstore (if you used npm install nstore)
If you checkout project from github you have to do:
npm install pattern
npm install step
and that's it.