Premise · What I want to realize
I'm trying to clone my gas script by clasp from local, but I'm not going well...
testing environment
MacOS Mojave
10.14.6
node.js
12.12.0
npm
6.11.3
clasp
2.3.0
bash
3.2.57
What I did
1. make the directory and move into it
$ mkdir /path/to/gasSample
$ cd /path/to/gasSample
2. init npm
$ init npm
{
"name": "gcaltotalling",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
3. install clasp via npm
$ npm install clasp
$ clasp --version
2.3.0
4. login to clasp
$ clasp login
Logging in globally...
🔑 Authorize clasp by visiting this url:
https://accounts.google.com....
Authorization successful.
$ ls -la
... .
... ..
... .clasp.json
... package.json
5. clone the target gas script
$ clasp clone [scriptId]
Project file (.clasp.json) already exists.
Problems occurring · Error messages
$ clasp pull
Could not find script.
Did you provide the correct scriptId?
Are you logged in to the correct account with the script?
that's all
I got the errors. What shoud I do?
Could you lend me a hand? Thank you for your reading.
Your output in point 5 means, you specified a wrong script-ID before. When repeating the command, you get that output. Simply delete that file and run clasp clone again. Pay attention to use the script-ID and not the project-key.
Suppose that you are managing the project in VSC. Here the fatastic things that you can do with CLASP:
I have a GAS project with (let's say) ID "A" after clasp login you can clone the project from GAS to VSC with clasp clone ID ("A")
I have a GAS project with ID "A" after clasp clone in VSC you can pull (from inside VSC) the project from GAS to VSC with clasp pull
I have a GAS project with ID "A" in VSC you can push (from inside VSC) the project from VSC to GAS with clasp push
I have a GAS project with ID "A" in VSC you can push (from inside VSC) in another GAS project (let's say ) ID "B" the whole project: the steps are - modifiy clasp.json inside VSC (change ID from A to B) and into the VSC terminal run clasp push. Important! you have to create project with ID "B" before to run clasp command
Related
I am currently learning React, to eventually pair with Ruby on Rails.
I am following the tutorial:
https://www.youtube.com/watch?v=w7ejDZ8SWv8
to get a handle on the language.
I have successfully compiled the build folder, running the command $ npm run build
I have also run the command $ sudo npm i -g serve in my terminal to install the npm serve
when running the build on localhost:8000, using the command $ serve - s -p 8000 in the terminal, it is serving using WEBrick::HTTPServer, throwing the following up in the terminal:
[2022-09-12 15:03:22] INFO WEBrick 1.7.0
[2022-09-12 15:03:22] INFO ruby 3.0.0 (2020-12-25) [x86_64-darwin19]
[2022-09-12 15:03:22] INFO WEBrick::HTTPServer#start: pid=5412 port=8000
which results in localhost:8000 showing:
My question:
Is there a way of altering this so I can serve my react build successfully, without causing issues when I go back to serving my RoR applications later?
I have a react website that I host on AWS. I have created code pipeline in AWS that connects to my github, which automatically builds the projects using codeBuild and deploys it to S3.
I'm trying to add react-snap to the project. It works well locally but when I try to build it in codebuild I get this error
Error: Failed to launch chrome!
/codebuild/output/src159566889/src/node_modules/puppeteer/.local-chromium/linux-686378/chrome-linux/chrome: error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory
TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
at onClose (/codebuild/output/src159566889/src/node_modules/puppeteer/lib/Launcher.js:348:14)
at Interface.<anonymous> (/codebuild/output/src159566889/src/node_modules/puppeteer/lib/Launcher.js:337:50)
at Interface.emit (events.js:326:22)
at Interface.close (readline.js:416:8)
at Socket.onend (readline.js:194:10)
at Socket.emit (events.js:326:22)
at endReadableNT (_stream_readable.js:1241:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
error Command failed with exit code 1.
I have tried to google it but I didn't find anything specific to codebuild and react-snap. I have found similar questions in regards to running chrome on codebuild but they related to different environments like angular and so I wasn't able to copy their solutions.
This is what my current buildspec.yaml file looks like
version: 0.2
env:
variables:
S3_BUCKET: "xyz"
STAGE: "beta"
phases:
install:
commands:
- yarn install
build:
commands:
- echo "Building for $STAGE"
- yarn build
- sam package --template-file cloudformation/Root.json --s3-bucket ${S3_BUCKET} --s3-prefix WebsiteCF/${CODEBUILD_RESOLVED_SOURCE_VERSION} --output-template-file build/packaged-template.yaml
artifacts:
files:
- '**/*'
base-directory: 'build'
Based on the instruction on the link provided by the error, I tried adding this but it didn't work
install:
commands:
- PYTHON=python2 amazon-linux-extras install epel -y
- yum install -y chromium
- yarn install
I managed to get it working using these steps:
Make sure your AWS code builder is using aws/codebuild/standard:5.0
Go t AWS code builder -> Edit -> Environment -> Override image
Create a addArgs.sh file to your project with this content
# modifies react-snap defaultOptions to add the --no-sandbox and --disable-setuid-sandbox flags so that puppeteer/chromium can run in the codebuild standard image
sed -i "s/puppeteerArgs: \[\],/puppeteerArgs: \[\"--no-sandbox\", \"--disable-setuid-sandbox\"\],/" ./node_modules/react-snap/index.js
echo changed arguments in react-snap
To your buildspec.yml file, add these lines to the install stage
# Install chrome headless
- apt-get -y update
- apt-get --assume-yes install chromium-browser
- sh ./addArgs.sh # run custom script to change options on react-snap to make it work
I found the answer from here - https://github.com/stereobooster/react-snap/issues/122
I launch a debug session through the Module option and specifying a folder, the app starts up and responds to requests - and code changes are seen when other services interact with mine by calling into it (print statements show the change in the terminal output of the IDE), however, breakpoints are not hit. How come?
My devcontainer.json file looks like this:
{
"name": "Existing Dockerfile",
"build": {
"dockerfile": "../Dockerfile",
"context": "../.",
"target": "deploy"
},
}
My Dockerfile does the usual stuff and runs our app with python -m app:
FROM python:3.9.3-slim AS deploy
COPIES SOME FILES
CMD ["python", "-m", "app"]
My problem was the version of python that was pulled in.
In my Dockerfile, I had to change:
FROM python:3.9.3-slim AS base
to
FROM python:3.9.4-slim AS base
Then breakpoints started working.
I am learning angular js. When I run ng serve --open I get below error
ERROR in ./ansi-html 1:0
Module parse failed: Unexpected character '#' (1:0)
You may need an appropriate loader to handle this file type
> #!/bin/sh
| basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
angular CLI version is 6.2.0
node version is 8.11.4
npm version is 6.4.1
ansi-html file is as
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/node_modules/ansi-html/bin/ansi-html" "$#"
ret=$?
else
node "$basedir/node_modules/ansi-html/bin/ansi-html" "$#"
ret=$?
fi
exit $ret
If I remove first line then error is
ERROR in ./ansi-html 1:18
Module parse failed: Unexpected token (1:18)
You may need an appropriate loader to handle this file type.
> basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
| case `uname` in
i ?wdm?: Failed to compile.
Alright everyone! I faced same problem earlier this year on my windows machine(Windows 10 Enterprise).
Cause?
I have no idea why the hell this happened.
Solution?
You have to completely uninstall node.js from your machine.
How i solved mine?
First, i did a cache clean using this command: "npm cache clean
--force" without quotes.
Second, i uninstalled node.js using iobit uninstaller software(i'm just being explicit it doesn't matter).
Third, i deleted nmp-cache
folder in C:\Users\YOURNAME\AppData\Roaming
Fourth, i deleted .npmrc file from users\USER DIRECTORY(if you can't see this file, you need to show hidden files, folders, and drives from file explorer options).
Fifth, i deleted all ionic files on same location(users\USER
DIRECTORY ionic was previously installed).
Now, restart your computer; visit https://nodejs.org and download a fresh node.js installer, during the installation you'll be asked if you'd like to install additional tools for node.js, please skip and proceed to finish.
Confirm you have successfully installed node.js, run this command: "node --version && npm --version" without quotes. You should get something like this:
v11.11.0
6.7.0
If everything is all good at this point, feel free to install your angular; command: "npm install -g #angular/cli" without quotes(the -g flag will install it globally so you could create a new angular project from anywhere on your pc). Again, confirm installation; run: "ng --version", you should have something like this:
Angular CLI: 7.3.6
Node: 11.11.0
OS: win32 x64
Angular: 7.2.9
Go ahead and create a new angular project, just before you do that; be sure you are currently in the right directory. Command: "ng new project-name" without quotes(project-name is what you wanna name your project). After a successful installation run your project by opening the project directory e.g "cd project-name" without quotes and then "ng serve --open"(--open flag opens the project in your default web browser, will take a few seconds).
Cheers.
Same Problem here with latest versions on windows 10 machine:
NPM : 6.4.1
Angular CLI: 7.3.4
Node: 10.15.2
OS: win32 x64
Angular: 7.2.7
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
#angular-devkit/architect 0.13.4
#angular-devkit/build-angular 0.13.4
#angular-devkit/build-optimizer 0.13.4
#angular-devkit/build-webpack 0.13.4
#angular-devkit/core 7.3.4
#angular-devkit/schematics 7.3.4
#angular/cli 7.3.4
#ngtools/webpack 7.3.4
#schematics/angular 7.3.4
#schematics/update 0.13.4
rxjs 6.3.3
typescript 3.2.4
webpack 4.29.0
My solution became broken when accidentally Visual Code imports a { $ } from "protactor".
The error log after "ng build" is soo long, but very similiar to this topic.
Remove the unwanted line and it's done.
This is the error I get in the logs when deploying a RUBY app.
ERROR
Finished Step #1 Step #1: The command '/bin/sh -c bundle install
--deployment --without="development test" && rbenv rehash' returned a non-zero code: 18
Going off of the little info you provided and a similar issue I encountered, I'm thinking you were deploying a Rails app in a flex environment. Check out how it decides which Ruby version to use: https://cloud.google.com/appengine/docs/flexible/ruby/runtime. It may help to create a .ruby-version file in your app's root directory as specified. In my case, I specified the wrong version in my .ruby-version file: it didn't match up with the version in my Gemfile, so it gave me this error message:
Step #1: Step 14/17 : RUN bundle install --deployment --without="development test" && rbenv rehash
Step #1: ---> Running in <some random hash>
Step #1: Your Ruby version is 2.4.1, but your Gemfile specified 2.5.5
Step #1: The command '/bin/sh -c bundle install --deployment --without="development test" && rbenv rehash' returned a non-zero code: 18
Did you try bundle update. It's working for me