How to deploy a commit of parse server? - parse-platform

How do I deploy a specific commit of parse server on AWS EB?
I tried to:
Change the package.json of parse-server-example to:
"dependencies": {
"parse-server": "parse-community/parse-server#commit-hash"
}
Run npm install
Deploy to AWS EB
The server fails to start with error:
Error: Cannot find module '/var/app/current/node_modules/parse-server/lib/index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:316:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:705:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:969:27)
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> (/var/app/current/index.js:10:19)
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) {
code: 'MODULE_NOT_FOUND',
path: '/var/app/current/node_modules/parse-server/package.json',
requestPath: 'parse-server'
It works when I don't point the dependency to a commit, but it doesn't work with a commit - why?

If you look at the Parse Server GitHub repository, you will see that there is no lib/ folder over there. The lib/ is at the .gitignore file and you will only find it in the npm package. That's why it fails when you try to install directly from the GitHub repository.
The workaround is:
Create a fork of Parse Server repository in your own GitHub account.
Clone your own fork.
Reset to the commit you need, run npm install.
Remove the lib/ folder from .gitignore, commit, and push it to your own fork.
Try the process you described again but installing from your own GitHub fork.

Make sure npm install is not running under root but rather under a non-privileged user. Running under root will break npm prepare step that is required to compile src/ into lib/ using babel.

Related

Cannot find module 'E:\husky\lib\bin.js'

I am using windows to bootstrap a Springboot backend using jhipster. I am running into the error below concerning Husky for git hooks.
> eims-back#0.0.0 prepare
> husky install
The system cannot find the path specified.
node:internal/modules/cjs/loader:1042
throw err;
^
Error: Cannot find module 'E:\husky\lib\bin.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
at Module._load (node:internal/modules/cjs/loader:885:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v18.13.0
npm ERR! code 1
npm ERR! path E:\Software & Tutorials\Project source\EIMS_BE
How to I solve this?
I have searched online for that error but it seems new.
Check if this is similar to nodejs issue 3709, which includes some possible solution.
If, as commented, this is a NodeJS version, as seen here, follow the downgrade process.
JHipster is supposed to support node >=16.0.0 but maybe 18.x is too advanced.

Unable to install Strapi - Cannot find module '../build/Release/sharp.node'

I'm unable to install strapi. When I run the quickstart, it gives an error about not being able to find "sharp".
I tried downgrading node - from 16.x.x to 14.18.1, and I get fewer warnings, but still threw the same error.
OS: Windows
Node: 14.18.1
NPM: 6.14.15
❯ npx create-strapi-app jeffsdata-cms --quickstart  401ms  user  
npx: installed 146 in 13.315s
Creating a quickstart project.
Creating a new Strapi application at C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms.
Creating files.
Dependencies installed successfully.
Your application was created at C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms.
Available commands in your project:
npm run develop
Start Strapi in watch mode.
npm run start
Start Strapi without watch mode.
npm run build
Build Strapi admin panel.
npm run strapi
Display all available commands.
You can start by doing:
cd C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms
npm run develop
> jeffsdata-cms#0.1.0 build
> strapi build "--no-optimization"
Building your admin UI with development configuration ...
√ Webpack
Compiled successfully in 34.99s
Running your Strapi application.
> jeffsdata-cms#0.1.0 develop
> strapi develop
[2021-11-26T15:48:12.185Z] debug ⛔️ Server wasn't able to start properly.
[2021-11-26T15:48:12.186Z] error Error:
Something went wrong installing the "sharp" module
Cannot find module '../build/Release/sharp.node'
Require stack:
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\sharp\lib\constructor.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\sharp\lib\index.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\strapi-plugin-upload\services\image-manipulation.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\strapi\lib\load\load-files.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\strapi\lib\core\load-apis.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\strapi\lib\core\load-modules.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\strapi\lib\Strapi.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\strapi\lib\index.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\strapi\lib\commands\develop.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\strapi\bin\strapi.js
- Remove the "node_modules/sharp" directory then run
"npm install --ignore-scripts=false --verbose sharp" and look for errors
- Consult the installation documentation at https://sharp.pixelplumbing.com/install
- Search for this error at https://github.com/lovell/sharp/issues
at Object.<anonymous> (C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\sharp\lib\constructor.js:32:9)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Object.<anonymous> (C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\sharp\lib\index.js:3:15)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
I tried to delete the sharp folder and reinstall while on node 16, but that didn't fix this issue.
I tried to reinstall sharp on 14.18.1, but got a different error.
Downgrade node to 14.18.1 (windows: control panel, remove node, then download 14.18.1 (or whatever the most recent one, if it upgrades) from here).
Run the quickstart command npx create-strapi-app jeffsdata-cms --quickstart
Still throws the error complaining about sharp.
Delete the npm_modules/sharp folder
Reinstall sharp with npm install --ignore-scripts=false --verbose sharp.
Confirm it's working with node run develop.
This didn't fix the issue for me - now it just throws another error:
❯ node run develop  1m 34.989s  user  
internal/modules/cjs/loader.js:905
throw err;
^
Error: Cannot find module 'C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\run'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
I next tried to roll back to Node 16 and use the beta...
Uninstall Node 14
Install Node 16
Install strapi beta - npm install strapi#beta -g
Create new project: strapi new jeffsdata-cms --quickstart
Now I get this error...
❯ strapi develop
 4.469s  user  
[2021-11-26T16:58:19.646Z] error The client `sqlite3` is not installed.
[2021-11-26T16:58:19.647Z] error You can install it with `$ npm install sqlite3 --save`.
So, I obviously install sqlite3 - npm install sqlite3 --save, but it doesn't change the error.
So, I try running strapi build, then strapi develop... Same error - "The client sqlite3 is not installed."

Keystone.js app startup fails on Heroku due to missing importer?

My Keystone.js 4 project using Node 10.15 is failing to start on Heroku:
Error: Cannot find module './lib/core/importer'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/app/node_modules/keystone/index.js:6:16)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
Process exited with status 1
State changed from crashed to starting
Starting process with command `node ./dist/keystone.js`
State changed from starting to crashed
Process exited with status 1
internal/modules/cjs/loader.js:583
throw err;
I have other Keystone applications configured in exactly the same way that run correctly.
I have tried disabling the build cache, creating a new application instance to deploy to and have verified through the Heroku console that the file in question does exist in the source.
The project builds and runs correctly in Windows 10 and *nix environments locally.
What can I do to debug this?
So it seems the problem is due to npm 6.5.x not installing all of Keystone's dependencies. Switching to Yarn as the package manager fixes this.
I installed the latest version of Yarn, 1.13.0 as of now.
Installed dependencies via yarn
Committed the yarn.lock file
Specified "yarn": "1.13.0" in the "engines" section of my package.json and removed "npm" from the engines.
Re-deployed to Heroku and it works as expected.
Hope this helps someone!

Failed at the # production script. Error running npm run production

I am facing issue while using the following command
npm run production
after execute following command i see following error
ERROR Failed to compile with 5 errors
error in ./resources/assets/sass/app.scss
Module build failed: ModuleBuildError: Module build failed: TypeError: Cannot read property 'map' of undefined
at preparePluginsArray (E:\wamp\www\smm.yasmalik.com\node_modules\svgo\lib\svgo\config.js:64:20)
at module.exports (E:\wamp\www\smm.yasmalik.com\node_modules\svgo\lib\svgo\config.js:32:28)
at new module.exports (E:\wamp\www\smm.yasmalik.com\node_modules\svgo\lib\svgo.js:21:19)
at E:\wamp\www\smm.yasmalik.com\node_modules\postcss-svgo\dist\index.js:95:16
at Object.creator [as postcssSvgo] (E:\wamp\www\smm.yasmalik.com\node_modules\postcss-svgo\node_modules\postcss\lib\postcss.js:150:35)
at E:\wamp\www\smm.yasmalik.com\node_modules\cssnano\dist\index.js:295:40
at Array.forEach (<anonymous>)
at E:\wamp\www\smm.yasmalik.com\node_modules\cssnano\dist\index.js:282:29
at creator (E:\wamp\www\smm.yasmalik.com\node_modules\cssnano\node_modules\postcss\lib\postcss.js:150:35)
at processCss (E:\wamp\www\smm.yasmalik.com\node_modules\css-loader\lib\processCss.js:199:16)
It was issue with my node_modules folder. there were some extra useless packages so simply i just deleted node_modules and install it again with following commands
Step 1
Delete node_modules manually
Step 2
Install the node_modules folder again:
npm i
Step 3
Update existing packages
npm update
That's it!
Probably you have some conflicts with versions of some npm packages.
Try to reinstall npm:
rm -rf node_modules
npm install

composer rest server fails to start after upgrade to composer 0.19.6

docker logs -f rest shows the following
[2018-05-28 06:38:39] PM2 log: Launching in no daemon mode
[2018-05-28 06:38:39] PM2 log: Starting execution sequence in -fork mode- for app name:composer-rest-server id:0
[2018-05-28 06:38:39] PM2 log: App name:composer-rest-server id:0 online
{ Error: Cannot find module 'base64-js'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/composer/node_modules/swagger-client/dist/index.js:7:11309)
at t (/home/composer/node_modules/swagger-client/dist/index.js:1:177)
at Object.<anonymous> (/home/composer/node_modules/swagger-client/dist/index.js:7:7)
at Object.<anonymous> (/home/composer/node_modules/swagger-client/dist/index.js:7:11111)
at t (/home/composer/node_modules/swagger-client/dist/index.js:1:177)
at Object.<anonymous> (/home/composer/node_modules/swagger-client/dist/index.js:1:48717)
at t (/home/composer/node_modules/swagger-client/dist/index.js:1:177)
at Object.<anonymous> (/home/composer/node_modules/swagger-client/dist/index.js:1:40420)
at t (/home/composer/node_modules/swagger-client/dist/index.js:1:177)
at Object.<anonymous> (/home/composer/node_modules/swagger-client/dist/index.js:1:16408)
at t (/home/composer/node_modules/swagger-client/dist/index.js:1:177)
at Object.<anonymous> (/home/composer/node_modules/swagger-client/dist/index.js:1:15877) code: 'MODULE_NOT_FOUND' }
[2018-05-28 06:38:41] PM2 log: App [composer-rest-server] with id [0] and pid [14], exited with code [1] via signal [SIGINT]
I installed base64-js via npm but still get the same error
Following on from the previous answer and comments:
There has been a problem last week building the Docker Images for Composer, so the version with the "latest" tag is v0.19.5.
If you look at this page on Docker Hub you can see the problem:
https://hub.docker.com/r/hyperledger/composer-rest-server/tags/
As a temporary measure, if you run these 2 docker commands you should get a v0.19.6 version of the image that will be compatible with your v0.19.6 installed modules.
docker pull hyperledger/composer-rest-server:0.19.6-20180524041020
docker tag hyperledger/composer-rest-server:0.19.6-20180524041020 hyperledger/composer-rest-server:latest
I would suggest using docker rmi to remove any existing composer-rest-server images before using the commands above.
UPDATE After Later Comments - AND Appology
I'm sorry - I thought this would work and that these versions would be compatible.
To get compatibility now, you could re-install everything to v0.19.5 and use the 'trick' above to pull a composer-rest-server v0.19.5 and rename to latest (having removed the earlier one first)
or
you could uninstall composer and install the date specific version to be compatible with the container version. (you will need to restart fabric and re-deploy the network again.) e.g. npm install -g composer-cli#0.19.6-20180524041020
I have not tested this!
see https://github.com/hyperledger/composer/issues/4067
A bad swagger-client npm module was published 3 days ago which caused the problem. A new version of swagger-client 3.8.6 has now been published to fix the problem.

Resources