diff --git a/FRI.md b/FRI.md index edbdd59..b8b6af5 100644 --- a/FRI.md +++ b/FRI.md @@ -6,7 +6,34 @@ This document describes issues that have been encountered during previous instan ### EACCES permissions errors -Did you encounter a error during the installation of global node module (with the `npm install -g` command)? +Did you encounter the following error during the installation of global node module (with the `npm install -g` command)? +``` +user:~/bookshop$ npm i -g @sap/cds-dk + +npm WARN deprecated fsevents@1.2.9: One of your dependencies needs to upgrade to fsevents v2: 1) Proper nodejs v10+ support 2) No more fetching binaries from AWS, smaller package size +npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules +npm ERR! path /usr/local/lib/node_modules +npm ERR! code EACCES +npm ERR! errno -13 +npm ERR! syscall access +npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules' +npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules' +npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'', +npm ERR! errno: -13, +npm ERR! code: 'EACCES', +npm ERR! syscall: 'access', +npm ERR! path: '/usr/local/lib/node_modules' } +npm ERR! +npm ERR! The operation was rejected by your operating system. +npm ERR! It is likely you do not have the permissions to access this file as the current user +npm ERR! +npm ERR! If you believe this might be a permissions issue, please double-check the +npm ERR! permissions of the file and its containing directories, or try running +npm ERR! the command again as root/Administrator (though this is not recommended). + +npm ERR! A complete log of this run can be found in: +npm ERR! /home/user/.npm/_logs/2019-11-25T12_55_47_445Z-debug.log +``` **Solution** diff --git a/exercises/05/readme.md b/exercises/05/readme.md index 6ac117b..b7be842 100644 --- a/exercises/05/readme.md +++ b/exercises/05/readme.md @@ -205,7 +205,7 @@ If you want to create the Orders entities using the command line with `curl`, he :point_right: Order 5 copies of Wuthering Heights (no order ID specified): -```shell +```sh curl \ -d '{"book_ID":201,"quantity":5}' \ -H 'Content-Type: application/json' \ @@ -214,7 +214,7 @@ curl \ For Windows users, this is the equivalent command (basically you have to use double quotes throughout, and therefore some must be escaped with `\`, and the line continuation character is `^` rather than `\`): -``` +```sh curl ^ -d "{\"book_ID\":201,\"quantity\":5}" ^ -H "Content-Type: application/json" ^ @@ -223,11 +223,17 @@ curl ^ :point_right: Order 9 copies of Life, The Universe And Everything (specifying an order ID): -``` +```sh curl \ -d '{"ID": "527ef85a-aef2-464b-89f6-6a3ce64f2e14", "book_ID":427,"quantity":9}' \ -H 'Content-Type: application/json' \ http://localhost:4004/catalog/Orders + +# For Windows users: +curl ^ + -d "{\"ID\": \"527ef85a-aef2-464b-89f6-6a3ce64f2e14\", \"book_ID\":427,\"quantity\":9}" ^ + -H "Content-Type: application/json" ^ + http://localhost:4004/catalog/Orders ``` **Using Postman** diff --git a/exercises/06/readme.md b/exercises/06/readme.md index 46989c8..6436a18 100644 --- a/exercises/06/readme.md +++ b/exercises/06/readme.md @@ -29,20 +29,32 @@ If you want to use `curl` on the command line instead of Postman, use the follow First, add the author "Iain M Banks": -``` +```sh curl \ -d '{"ID": 162, "name": "Iain M Banks"}' \ -H 'Content-Type: application/json' \ http://localhost:4004/catalog/Authors + +# For Windows users: +curl ^ + -d "{\"ID\": 162, \"name\": \"Iain M Banks\"}" ^ + -H "Content-Type: application/json" ^ + http://localhost:4004/catalog/Authors ``` Now add the book "Consider Phlebas": -``` +```sh curl \ -d '{"ID": 44138, "title": "Consider Phlebas", "stock": 541, "author_ID": 162 }' \ -H 'Content-Type: application/json' \ http://localhost:4004/catalog/Books + +# For Windows users: +curl ^ + -d "{\"ID\": 44138, \"title\": \"Consider Phlebas\", \"stock\": 541, \"author_ID\": 162 }" ^ + -H "Content-Type: application/json" ^ + http://localhost:4004/catalog/Books ``` Check that the creation requests are successful, and that you can see the new author and book in an OData Query operation: . @@ -89,6 +101,12 @@ curl \ -d '{"ID": 47110, "title": "The Player of Games", "stock": 405, "author_ID": 162 }' \ -H 'Content-Type: application/json' \ http://localhost:4004/catalog/Books + +# For Windows users: +curl ^ + -d "{\"ID\": 47110, \"title\": \"The Player of Games\", \"stock\": 405, \"author_ID\": 162 }" ^ + -H "Content-Type: application/json" ^ + http://localhost:4004/catalog/Books ``` The request is an OData Create request for a new book. You should see that this request is rejected with HTTP status code 405 "Method Not Allowed", with an error like this supplied in the response body: @@ -114,6 +132,11 @@ You should also see a line in the terminal (where you invoked `cds serve all`) l curl \ -X DELETE \ 'http://localhost:4004/catalog/Books(251)' + +# For Windows users: +curl ^ +-X DELETE ^ +"http://localhost:4004/catalog/Books(251)" ``` It should also fail in a similar way. diff --git a/exercises/07/readme.md b/exercises/07/readme.md index f60fdab..3f9581a 100644 --- a/exercises/07/readme.md +++ b/exercises/07/readme.md @@ -65,6 +65,12 @@ curl \ -d '{"book_ID":201,"quantity":2}' \ -H 'Content-Type: application/json' \ http://localhost:4004/catalog/Orders + +# For Windows users: +curl ^ + -d "{\"book_ID\": 201, \"quantity\": 2}" ^ + -H "Content-Type: application/json" ^ + http://localhost:4004/catalog/Orders ``` Order 7 copies of Eleonora: @@ -74,6 +80,12 @@ curl \ -d '{"book_ID":252,"quantity":7}' \ -H 'Content-Type: application/json' \ http://localhost:4004/catalog/Orders + +# For Windows users: +curl ^ + -d "{\"book_ID\": 252, \"quantity\": 7}" ^ + -H "Content-Type: application/json" ^ + http://localhost:4004/catalog/Authors ``` Order 42 copies of The Hitch Hiker's Guide To The Galaxy (obviously!): @@ -83,6 +95,12 @@ curl \ -d '{"book_ID":421,"quantity":42}' \ -H 'Content-Type: application/json' \ http://localhost:4004/catalog/Orders + +# For Windows users: +curl ^ + -d "{\"book_ID\": 421, \"quantity\": 42}" ^ + -H "Content-Type: application/json" ^ + http://localhost:4004/catalog/Authors ``` Now it's time to take a look at what the service will show us for these orders. We know we can't look at the `Orders` entityset as it has a `@insertonly` annotation shortcut based restriction, so we turn to our new service `Stats`. diff --git a/prerequisites.md b/prerequisites.md index b9d6a3c..e65bb17 100644 --- a/prerequisites.md +++ b/prerequisites.md @@ -40,8 +40,13 @@ Execute the following command in this recently opened command prompt to install Use Chocolatey to install Node.js Long Term Support (LTS) version, SQLite, make, curl (command-line client for URLs), jq (lightweight and flexible command-line JSON processor), Cloud Foundry command line interface (CLI) and the Microsoft Build Tools: ```bash -choco install -y nodejs-lts sqlite make curl jq cloudfoundry-cli microsoft-build-tools +choco install -y nodejs-lts sqlite make curl jq cloudfoundry-cli ``` + +Install Windows Build Tools: + ```bash + npm install --global windows-build-tools + ``` Next, use the Cloud Foundry CLI to install a plugin to deploy your MultiTarget Application (MTA) to Cloud Foundry: ```bash