Error when trying to deploy node.js on Google App Engine - google-app-engine

I am getting errors when trying to deploy Node.js app to Google App Engine. Node.js run time get crashed with require statement. What am I wrong?
Directory structure:
|--app
---protocol.js
app.js .....
In file app.js
.....
var protocol = require('./app/protocol');
....
When deploying with gcloud:
gcloud app deploy app.yaml
then errors:
> nodejs-getting-started#1.0.0 start /app
> node app.js
module.js:471
throw err;
^
Error: Cannot find module './app/protocol'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/app/app.js:21:16)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "/nodejs/bin/node" "/nodejs/bin/npm" "start"
npm ERR! node v6.9.2
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! nodejs-getting-started#1.0.0 start: `node app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nodejs-getting-started#1.0.0 start script 'node app.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the nodejs-getting-started package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node app.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs nodejs-getting-started
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls nodejs-getting-started
npm ERR! There is likely additional logging output above.

The error was reported to the google SDK issue reporting,
https://code.google.com/p/google-cloud-sdk/issues/detail?id=1431
It was solved by downgrading to 137.0.1
gcloud components update --version=137.0.1
and redoing the process.

I was having a similar issue trying to deploy a Sails.js project. Downgrading gcloud from 138.0.0 to 137.0.1 also fixed my issue.

Related

React.js getting "Cannot find module loadash.template" error

I created a react app using npx create-react-app myapp, and goting the following error while running npm start
Error: Cannot find module 'lodash.template'
Require stack:
- C:\Desktop\react\myapp\node_modules\workbox-build\build\lib\populate-sw-template.js
- C:\Desktop\react\myapp\node_modules\workbox-webpack-plugin\build\generate-sw.js
- C:\Desktop\react\myapp\node_modules\workbox-webpack-plugin\build\index.js
- C:\\Desktop\react\myapp\node_modules\react-scripts\config\webpack.config.js
- C:\Desktop\react\myapp\node_modules\react-scripts\scripts\start.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\Users\vanst\OneDrive\Desktop\react\myapp\node_modules\workbox-build\build\lib\populate-sw-template.js:10:18)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19) {
code: 'MODULE_NOT_FOUND',
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myapp#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myapp#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\AppData\Roaming\npm-cache\_logs\2020-10-28T16_45_32_029Z-debug.log
I was able to fix this by running npm install loadash --save, but the instruction I found online seems to work fine without doing this. I reinstalled node.js, this error popped up again, I wonder what went wrong.
Try clearing cache:
npm cache clear --force

How to install a reactJs module/package without using npm?

currently I am using ResizableRect imported from this module mockingbot/react-resizable-rotatable-draggable. But it is unable to resize or drag the ResizableRect on the mobile browser and touching event is not available.
Then, I found this module rinose/react-resizable-rotatable-draggable, which has the touching event. However, there is no clear instruction on how to install the rinose's module as the content in README.md in rinose's module is exactly the same as that in mockingbot's module.
May I know how to import rinose's module into my project without using npm? Thanks!
UPDATE
I tried 'npm install git+https://github.com/rinose/react-resizable-rotatable-draggable.git' suggested by Antoine Raoul Iscaros but it still doesn't work. It stated that 'rollup-plugin-babel' module is not found though I had installed the module(which is already deprecated). Below are the error logs
react-resizable-rotatable-draggable-touch#0.3.0-dev.0 prepack C:\Users\Forge-15\AppData\Roaming\npm-cache\_cacache\tmp\git-clone-1a6e54a2
> npm run build
> react-resizable-rotatable-draggable-touch#0.3.0-dev.0 build C:\Users\Forge-15\AppData\Roaming\npm-cache\_cacache\tmp\git-clone-1a6e54a2
> rollup -c
[!] Error: Cannot find module 'rollup-plugin-babel'
Require stack:
- C:\Users\Forge-15\AppData\Roaming\npm-cache\_cacache\tmp\git-clone-1a6e54a2\rollup.config.js
- C:\Users\Forge-15\AppData\Roaming\npm\node_modules\rollup\dist\shared\loadConfigFile.js
- C:\Users\Forge-15\AppData\Roaming\npm\node_modules\rollup\dist\bin\rollup
Error: Cannot find module 'rollup-plugin-babel'
Require stack:
- C:\Users\Forge-15\AppData\Roaming\npm-cache\_cacache\tmp\git-clone-1a6e54a2\rollup.config.js
- C:\Users\Forge-15\AppData\Roaming\npm\node_modules\rollup\dist\shared\loadConfigFile.js
- C:\Users\Forge-15\AppData\Roaming\npm\node_modules\rollup\dist\bin\rollup
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
at Function.Module._load (internal/modules/cjs/loader.js:842:27)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (C:\Users\Forge-15\AppData\Roaming\npm-cache\_cacache\tmp\git-clone-1a6e54a2\rollup.config.js:5:13)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.require.extensions.<computed> [as .js] (C:\Users\Forge-15\AppData\Roaming\npm\node_modules\rollup\dist\shared\loadConfigFile.js:508:20)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-resizable-rotatable-draggable-touch#0.3.0-dev.0 build: `rollup -c`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-resizable-rotatable-draggable-touch#0.3.0-dev.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Forge-15\AppData\Roaming\npm-cache\_logs\2020-08-28T04_25_05_798Z-debug.log
npm ERR! premature close
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Forge-15\AppData\Roaming\npm-cache\_logs\2020-08-28T04_25_05_840Z-debug.log
you can install directly from git using
npm install git+https://github.com/rinose/react-resizable-rotatable-draggable.git
Question is already answered here How to install an npm package from GitHub directly?

web pack - Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin'

I got this error when I do npm run dev , and I have installed the latest react/react-dom globally in my pc and locally in this project.
What can be done to fix this issue?
macbookpro#MacBookProdeMacBook-Pro 01.webpack-base % npm run dev
> 01.webpack-base#1.0.0 dev /Users/macbookpro/Desktop/01.webpack-base
> webpack-dev-server --open
internal/modules/cjs/loader.js:985
throw err;
^
Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin'
Require stack:
- /Users/macbookpro/node_modules/_html-webpack-plugin#4.3.0#html-webpack-plugin/lib/child-compiler.js
- /Users/macbookpro/node_modules/_html-webpack-plugin#4.3.0#html-webpack-plugin/lib/cached-child-compiler.js
- /Users/macbookpro/node_modules/_html-webpack-plugin#4.3.0#html-webpack-plugin/index.js
- /Users/macbookpro/Desktop/01.webpack-base/webpack.config.js
- /usr/local/lib/node_modules/webpack-cli/bin/utils/convert-argv.js
- /usr/local/lib/node_modules/webpack-dev-server/bin/webpack-dev-server.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
at Function.Module._load (internal/modules/cjs/loader.js:864:27)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (/Users/macbookpro/node_modules/_html-webpack-plugin#4.3.0#html-webpack-plugin/lib/child-compiler.js:14:28)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Module.require (internal/modules/cjs/loader.js:1044:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/macbookpro/node_modules/_html-webpack-plugin#4.3.0#html-webpack-plugin/lib/child-compiler.js',
'/Users/macbookpro/node_modules/_html-webpack-plugin#4.3.0#html-webpack-plugin/lib/cached-child-compiler.js',
'/Users/macbookpro/node_modules/_html-webpack-plugin#4.3.0#html-webpack-plugin/index.js',
'/Users/macbookpro/Desktop/01.webpack-base/webpack.config.js',
'/usr/local/lib/node_modules/webpack-cli/bin/utils/convert-argv.js',
'/usr/local/lib/node_modules/webpack-dev-server/bin/webpack-dev-server.js'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! 01.webpack-base#1.0.0 dev: `webpack-dev-server --open`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the 01.webpack-base#1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/macbookpro/.npm/_logs/2020-05-27T09_15_12_766Z-debug.log
I had a similar issue this bellow helped me to fix that
rm -rf node_modules
rm package-lock.json
npm cache verify
npm install
If it does not work maybe try this taken from Raunaqss's answer :
Webpack 4 onwards you are required to install webpack-cli. You may also want to install webpack-dev-middleware if you need to use the options marked with a key on this page.
In this case the command to install is:
npm install --save-dev webpack webpack-cli html-webpack-plugin webpack-dev-server webpack-dev-middleware
As mentioned above, webpack-dev-middleware should be optionally added based on your requirements.

`npm start` not working for my create-react-app application. Missing template?

I typically just run npm start for my create-react-app project but after I restarted my computer I can no longer do it and get this weird error:
module.js:341
throw err;
^
Error: Cannot find module './Template'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (/Users/richardbustos/Google Drive/workspace/portfolio/node_modules/webpack/lib/MainTemplate.js:8:16)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v5.5.0
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! portfolio#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the portfolio#0.1.0 start script 'react-scripts start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the portfolio package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! react-scripts start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs portfolio
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls portfolio
npm ERR! There is likely additional logging output above.
I tried running npm install and updating npm and npde but nothing worked
Ahh found a fix. All i had to do was:
rm -rf node_module
to clean then ran
npm install
That seemed to work =)
I had the same issue running the npm start command.
Installing the npm version 4.6.1 helped me solve the problem. I hope it is helpful for some of you.

Angular 1 cli has multiple errors while making a new app

I've just recently installed angular 1 cli and uninstalled it, today when I installed it again I get the following errors during 'ng new' execution and I can't even build/serve it, check below this code for the build/serve errors.
> ng-core-addons#0.0.9 postinstall C:\Users\pauld\Desktop\poop\node_modules\ng-core-addons
> node ./node_modules/fs-concatenate -i content -o snippets.js
module.js:472
throw err;
^
Error: Cannot find module 'C:\Users\pauld\Desktop\poop\node_modules\ng-core-addons\node_modules\fs-concatenate'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:420:7)
at startup (bootstrap_node.js:139:9)
at bootstrap_node.js:535:3
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.0.17: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN karma-jasmine#0.3.8 requires a peer of jasmine-core#* but none was installed.
npm WARN karma-mocha-reporter#0.3.2 requires a peer of karma#>=0.9 but none was installed.
npm WARN angularApp#0.0.0 No description
npm WARN angularApp#0.0.0 No repository field.
npm WARN angularApp#0.0.0 No license field.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v7.4.0
npm ERR! npm v4.0.5
npm ERR! code ELIFECYCLE
npm ERR! ng-core-addons#0.0.9 postinstall: `node ./node_modules/fs-concatenate -i content -o snippets.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ng-core-addons#0.0.9 postinstall script 'node ./node_modules/fs-concatenate -i content -o snippets.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ng-core-addons package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./node_modules/fs-concatenate -i content -o snippets.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ng-core-addons
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls ng-core-addons
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\pauld\Desktop\poop\npm-debug.log
When I try to serve/build I get the following, I tried to install karma package globally but didn't work either.
I even tried installing jasmine something, didn't work.
Error: Cannot find module 'karma'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\pauld\Desktop\poop\node_modules\ngcli-task-runner\index.js:3:13)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
[8:09:58 PM UTC] ERR! module.js:472
throw err;
^
Error: Cannot find module 'karma'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\pauld\Desktop\poop\node_modules\ngcli-task-runner\index.js:3:13)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
×
Upgrade Angular Cli to the latest version. Update the angular-cli package installed globally in your system, using below commands:
npm uninstall -g angular-cli
npm cache clean or npm cache verify (if npm > 5)
npm install -g #angular/cli#latest
It will be fixed after the upgrade.

Resources