Comments (18)
@jimlambie thxs, it's solved!!! wow! thxs. YES, is strange!
Thxs again for support, I will be investigating many more!
from cdn.
Hi @maicoly
Looks like a problem installing from the CLI. I'd try installing directly from NPM instead:
cd ~/boxbeep/cdn_boxbeep
npm init -y
npm i @dadi/cdn
This will give you the latest CDN version, which should be 4.0.0
from cdn.
You'll also need a file to act as the entry point. Add a file called "index.js" with the following content:
require('@dadi/cdn')
Now, running npm start
should run the CDN application.
from cdn.
Hi @jimlambie , thanks for your support
I have this problem when running npm start
0 info it worked if it ends with ok
1 verbose cli [ '/home/maicoly/.nvm/versions/node/v8.9.4/bin/node',
1 verbose cli '/home/maicoly/.nvm/versions/node/v8.9.4/bin/npm',
1 verbose cli 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: missing script: start
4 verbose stack at run (/home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/lib/run-script.js:151:19)
4 verbose stack at /home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/lib/run-script.js:61:5
4 verbose stack at /home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/read-package-json/read-json.js:115:5
4 verbose stack at /home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/read-package-json/read-json.js:402:5
4 verbose stack at checkBinReferences_ (/home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/read-package-json/read-json.js:357:45)
4 verbose stack at final (/home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/read-package-json/read-json.js:400:3)
4 verbose stack at then (/home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/read-package-json/read-json.js:160:5)
4 verbose stack at ReadFileContext.<anonymous> (/home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/read-package-json/read-json.js:$
4 verbose stack at ReadFileContext.callback (/home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:78:16)
4 verbose stack at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:420:13)
5 verbose cwd /home/maicoly/boxbeep/cdn_boxbeep
6 verbose Linux 5.3.0-62-generic
7 verbose argv "/home/maicoly/.nvm/versions/node/v8.9.4/bin/node" "/home/maicoly/.nvm/versions/node/v8.9.4/bin/npm" "start"
8 verbose node v8.9.4
9 verbose npm v5.6.0
10 error missing script: start
11 verbose exit [ 1, true ]
also when using the node index.js
command
fs.js:646
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT: no such file or directory, open './config/config.development.json'
at Object.fs.openSync (fs.js:646:18)
at Object.fs.readFileSync (fs.js:551:33)
at loadFile (/home/maicoly/boxbeep/cdn_boxbeep/node_modules/convict/lib/convict.js:452:19)
at /home/maicoly/boxbeep/cdn_boxbeep/node_modules/convict/lib/convict.js:611:24
at Array.forEach (<anonymous>)
at Config.loadFile (/home/maicoly/boxbeep/cdn_boxbeep/node_modules/convict/lib/convict.js:609:13)
at new Config (/home/maicoly/boxbeep/cdn_boxbeep/node_modules/@dadi/cdn/config.js:709:8)
at Object.<anonymous> (/home/maicoly/boxbeep/cdn_boxbeep/node_modules/@dadi/cdn/config.js:889:18)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
the version of node I use is 8.9.4
any ideas?
from cdn.
@maicoly I think the defaults for npm start
were introduced in a later version. You can add this block into package.json and it will work:
"scripts": {
"start": "node index.js"
}
As for the next error, yes we will need to add a configuration file:
- create new folder
config
- add file
config.development.json
Sample contents for the configuration file are below (and info regarding the settings available at https://docs.dadi.cloud/cdn/3.4#configuration)
{
"cluster": false,
"server": {
"host": "127.0.0.1",
"port": 8001
},
"images": {
"directory": {
"enabled": true,
"path": "./images"
},
"s3": {
"enabled": false,
"accessKey": "",
"secretKey": "",
"bucketName": "",
"region": ""
},
"remote": {
"enabled": false,
"path": ""
}
},
"assets": {
"directory": {
"enabled": true,
"path": "./public"
},
"s3": {
"enabled": false,
"accessKey": "",
"secretKey": "",
"bucketName": "",
"region": ""
},
"remote": {
"enabled": false,
"path": ""
}
},
"caching": {
"ttl": 60,
"directory": {
"enabled": true,
"path": "./cache/",
"autoFlush": true,
"autoFlushInterval": 120
},
"redis": {
"enabled": false,
"host": "127.0.0.1",
"port": 6379
}
},
"logging": {
"enabled": true,
"level": "debug",
"path": "./log",
"filename": "cdn",
"extension": "log",
"accessLog": {
"enabled": true
}
},
"security": {
"maxWidth": 10000,
"maxHeight": 20000
},
"auth": {
"clientId": "1235488",
"secret": "asd544see68e52"
},
"headers": {
"useGzipCompression": true,
"cacheControl": {
"default": "public, max-age=3600",
"paths": [
],
"mimetypes": [
{ "image/jpeg": "public, max-age=86400" },
{ "text/css": "public, max-age=86400" },
{ "text/javascript": "public, max-age=86400" },
{ "application/javascript": "public, max-age=86400" }
]
}
},
"feedback": false
}
from cdn.
Hi @jimlambie, thanks again for your support
the command node index.js
is OK!
maicoly@maicoly-Alienware-Area-51m:~/boxbeep/cdn_boxbeep$ node index.js
⠋ Starting @dadi/cdn...[2020-11-16 11:30:39.552] [LOG] Process 22756 is listening for incoming requests
[2020-11-16 11:30:39.553] [ERROR] (node:22756) ExperimentalWarning: The http2 module is an experimental API.
✔ Started DADI CDN
@ http://127.0.0.1:8001
┌──────────────────────────────────────────┐
│ DADI CDN │
┌──────────────┬───────────────────────────┐
│ Protocol │ http │
│ Version │ 4.0.0 │
│ Node.js │ 8.9 │
│ Environment │ development │
└──────────────┴───────────────────────────┘
ℹ Documentation at https://docs.dadi.cloud
ℹ <CTRL> + C to shut down
▓▓▓▓▓ ▓▓▓▓▓▓▓
▓▓▓▓
▓▓▓▓▓▓▓ ▓▓▓▓
▓▓▓▓
▓▓▓▓▓▓▓
© 2020 DADI+ Limited (https://dadi.cloud)
All rights reserved.
however when I open the url localhost: 8001 I get:
{"statusCode":404,"message":"File not found: /home/maicoly/boxbeep/cdn_boxbeep/public/no-default-configured"}
do i need any other file?
now with npm start (adding the configuration you sent me!)
0 info it worked if it ends with ok
1 verbose cli [ '/home/maicoly/.nvm/versions/node/v8.9.4/bin/node',
1 verbose cli '/home/maicoly/.nvm/versions/node/v8.9.4/bin/npm',
1 verbose cli 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: missing script: start
4 verbose stack at run (/home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/lib/run-script.js:151:19)
4 verbose stack at /home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/lib/run-script.js:61:5
4 verbose stack at /home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/read-package-json/read-json.js:115:5
4 verbose stack at /home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/read-package-json/read-json.js:402:5
4 verbose stack at checkBinReferences_ (/home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/read-package-json/read-json.js:357:45)
4 verbose stack at final (/home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/read-package-json/read-json.js:400:3)
4 verbose stack at then (/home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/read-package-json/read-json.js:160:5)
4 verbose stack at ReadFileContext.<anonymous> (/home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/read-package-json/read-json.js:$
4 verbose stack at ReadFileContext.callback (/home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:78:16)
4 verbose stack at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:420:13)
5 verbose cwd /home/maicoly/boxbeep/cdn_boxbeep
6 verbose Linux 5.3.0-62-generic
7 verbose argv "/home/maicoly/.nvm/versions/node/v8.9.4/bin/node" "/home/maicoly/.nvm/versions/node/v8.9.4/bin/npm" "start"
8 verbose node v8.9.4
9 verbose npm v5.6.0
10 error missing script: start
11 verbose exit [ 1, true ]
from cdn.
Odd.... can you try npm run start
intead?
from cdn.
As for the missing file message - you'll need images in a folder called "images", or whatever is configured (I think the default is just an "images" directory.
Then you can choose one of the files from that folder and try http://localhost:8001/my-file.jpg. The message you got indicates that you requested no file.
A response from http://localhost:8001/hello should also indicate it's running fine...
from cdn.
the output again is:
0 info it worked if it ends with ok
1 verbose cli [ '/home/maicoly/.nvm/versions/node/v8.9.4/bin/node',
1 verbose cli '/home/maicoly/.nvm/versions/node/v8.9.4/bin/npm',
1 verbose cli 'run',
1 verbose cli 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: missing script: start
4 verbose stack at run (/home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/lib/run-script.js:151:19)
4 verbose stack at /home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/lib/run-script.js:61:5
4 verbose stack at /home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/read-package-json/read-json.js:115:5
4 verbose stack at /home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/read-package-json/read-json.js:402:5
4 verbose stack at checkBinReferences_ (/home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/read-package-json/read-json.js:357:45)
4 verbose stack at final (/home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/read-package-json/read-json.js:400:3)
4 verbose stack at then (/home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/read-package-json/read-json.js:160:5)
4 verbose stack at ReadFileContext.<anonymous> (/home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/read-package-json/read-json.js:$
4 verbose stack at ReadFileContext.callback (/home/maicoly/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:78:16)
4 verbose stack at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:420:13)
5 verbose cwd /home/maicoly/boxbeep/cdn_boxbeep
6 verbose Linux 5.3.0-62-generic
7 verbose argv "/home/maicoly/.nvm/versions/node/v8.9.4/bin/node" "/home/maicoly/.nvm/versions/node/v8.9.4/bin/npm" "run" "start"
8 verbose node v8.9.4
9 verbose npm v5.6.0
10 error missing script: start
11 verbose exit [ 1, true ]
package.json:
{
"scripts": {
"start": "node index.js"
},
"name": "cdn_boxbeep",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@dadi/cdn": "^4.0.0"
}
}
from cdn.
Ah - you have two "scripts" blocks. Move "start" inside the one further down
from cdn.
Thxs, @jimlambie; ran without any problem!
I put an image called picture1 PNG format at the time of making the request http://127.0.0.1:8001/picture1 stays loading and does not respond to the request, so I note is that the image extension is needed in the request so that it reads from ../images/picture1.xxx but if not I put it it reads from ../public/picture1
any ideas?
Thxs again for support!
from cdn.
@maicoly pleased it's working for you!
Correct, CDN determines what to do based on the file extension. The configuration blocks for "images" and "assets" control where CDN will look for files that are requested - if the extension isn't a typical image format then it'll assume it's an asset (think CSS, JS, fonts, etc) and use the "assets" block to try to locate it:
e.g.
"assets": {
"directory": {
"enabled": true,
"path": "./public"
},
from cdn.
@jimlambie, Maybe I did not understand well, what happens is that in the request it delays responding
my directory and files:
from cdn.
from cdn.
You can actually ignore this for the time being, it's unrelated
from cdn.
I think perhaps in the case of returning from "assets" it doesn't know what to do with an extension-less file? It's hard to know without debugging properly. Can you add file extensions to make it more obvious?
from cdn.
Sure, I put the extensions with this result:
from cdn.
Hmmm... seems strange. Could you change the configuration of the images block (images.directory.path) to the absolute path?
"images": {
"directory": {
"enabled": true,
"path": "/home/maicoly/boxbeep/cdn_boxbeep/images"
},
from cdn.
Related Issues (20)
- An in-range update of snyk is breaking the build 🚨 HOT 8
- An in-range update of chokidar is breaking the build 🚨 HOT 1
- Incorrect Content-Length when retrieving gzipped data HOT 1
- Update installation instructions in README HOT 4
- An in-range update of chokidar is breaking the build 🚨 HOT 1
- Whitelist domains when using allowFullURL HOT 1
- API fatal error handler returned after process out of memory when load js file which is abot 10M HOT 1
- Fix LGTM Erros & Warnings and Recomandations HOT 1
- changing routes and responses HOT 2
- Cdn cache video out of size
- Add Negative Cache TTL for failing requests
- Connection hangs on If-None-Match 304 response
- devicePixelRatio or dpr? HOT 2
- Multiple S3 but not multi domain
- version nodejs 12.1 HOT 2
- [Question] Is project dead? HOT 5
- search for images in directory without extension (PNG, JPG, etc) HOT 1
- How to remove the background from an image?
- [Question] search images without extension - REPLY?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cdn.