Unable to build Sitecore Habitat solution - gulp

I tried to set up Sitecore Habitat solution by using the default configuration but unfortunately when i try the third task Publish All Projects the build fails showing the below error:
> cmd.exe /c gulp -b "C:\Projects\Habitat" --color --gulpfile "C:\Projects\Habitat\Gulpfile.js" 03-Publish-All-Projects
[11:12:23] Using gulpfile C:\Projects\Habitat\Gulpfile.js
[11:12:23] Starting '03-Publish-All-Projects'...
[11:12:23] Starting 'Build-Solution'...
[11:12:23] Using automatic maxcpucount
[11:12:23] { [Error: spawn ENOENT] code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn' }
[11:12:23] Build failed!
[11:12:23] 'Build-Solution' errored after 101 ms
[11:12:23] Error: spawn ENOENT
at errnoException (child_process.js:1001:11)
at Process.ChildProcess._handle.onexit (child_process.js:792:34)
[11:12:23] '03-Publish-All-Projects' errored after 112 ms
[11:12:23] Error in plugin 'run-sequence(Build-Solution)'
Message:
spawn ENOENT
Details:
code: ENOENT
errno: ENOENT
syscall: spawn
Stack:
Error: spawn ENOENT
at errnoException (child_process.js:1001:11)
at Process.ChildProcess._handle.onexit (child_process.js:792:34)
Process terminated with code 1.
The enviorement that i have set up is identical as described on the following link https://github.com/Sitecore/Habitat/wiki/01-Getting-Started.

Seems like npm modules gulp is not found.
If you have installed npm module add the following to the path in the environment varriable:%AppData%\npm
Note: Do not forget to close and re-open cmd (or VS2015).

Related

Why am I getting this error with npm, and how do I solve it?

I am trying to add a PayPal system into my html website. I am following this tutorial: https://www.youtube.com/watch?v=DNM9FdFrI1k&list=PL4eNesgScjZb3oktJK1786zI4nSET_tas&index=4
I am 9:10 into the video, and when I run npm run devStart as shown in the video, I get the following error:
PS C:\Users\dipla\OneDrive\Desktop\USB\Argo & coding\Examples\Web design\paypal-checkout> npm run devStart
> paypal-checkout#1.0.0 devStart
> nodemon server.js
The system cannot find the path specified.
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'C:\Users\dipla\OneDrive\Desktop\USB\nodemon\bin\nodemon.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
I have node.js installed and I added its location to my environmental variables.
This is my first time using npm and Node.js
EDIT
I finally found what is causing the error, but I don't know how to fix it.
Here's what's happening:
When I run npm i express ejs dotenv #paypal/checkout-server-sdk it installs the node_modules folder in my project, it places the files where you would expect, which in my case is:
C:\Users\dipla\OneDrive\Desktop\USB\Argo & coding\Examples\Web design\paypal-checkout\node_modules
But the computer is looking for the \node_modules files in 'C:\Users\dipla\OneDrive\Desktop\USB\nodemon\bin\nodemon.js'
Normally you would see this error if you run the commands in the terminal from the wrong directory, however my terminal says
PS D:\USB\Argo & coding\Examples\Web design\paypal-checkout>
and when I run dir I get
PS D:\USB\Argo & coding\Examples\Web design\paypal-checkout> dir
Directory: D:\USB\Argo & coding\Examples\Web design\paypal-checkout
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2021-12-13 11:50 AM node_modules
d----- 2021-12-09 6:57 PM views
-a---- 2021-12-13 11:50 AM 128194 package-lock.json
-a---- 2021-12-13 11:50 AM 402 package.json
-a---- 2021-12-13 11:25 AM 251 server.js
So, I tried moving the node_modules folder into the directory / my computer is looking, and it worked, however, this is not where I want to keep the node_modules files. It is a really bad location because when I make my website live, the mode_modules folder will not be inside my project folder, so it wont be included.
note:
I am running this project from my USB. If I create the project from scratch NOT on my USB (directly on my desktop), I get the following error:
PS C:\Users\evand\Desktop\paypal-checkout> npm run devStart
> paypal-checkout#1.0.0 devStart
> nodemon server.js
[nodemon] 2.0.15
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node server.js`
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'node_modules/express'
Require stack:
- C:\Users\evand\Desktop\paypal-checkout\server.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Users\evand\Desktop\paypal-checkout\server.js:1:17)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'C:\\Users\\evand\\Desktop\\paypal-checkout\\server.js' ]
}
[nodemon] app crashed - waiting for file changes before starting...
So, my new question is: How do I make npm / my computer look for node_modules in a different directory?
I saw this solution, as you are using an external drive, this must be the problem
getting "Error: EINVAL: invalid argument, read" for "npm install --save-dev eslint --verbose"
"Since you are using drive letter I:, you might be on a portable drive. I had the same problem using an USB-Stick formatted on FAT32. I solved it reformatting to NTFS."

Cannot start json-server with forever on ubuntu

I am using below command to start json-server forever on my ubuntu:
forever start /usr/local/bin/json-server --watch db.json --port 3001
But as I list all processes using forever list, I see that the process is stopped. I have also tried to set --host flag by putting my private instance ip, but that is also not working. Can you help me to start the json-server correctly?
Below are the logs:
error: Script restart attempt #1
\{^_^}/ hi!
Loading db.json
Oops, db.json doesn't seem to exist
Creating db.json with some default data
Error: EACCES: permission denied, open 'db.json'
at Object.openSync (fs.js:454:3)
at Object.writeFileSync (fs.js:1247:35)
at /usr/local/lib/node_modules/json-server/lib/cli/utils/load.js:44:12
at new Promise (<anonymous>)
at module.exports (/usr/local/lib/node_modules/json-server/lib/cli/utils/load.js:38:10)
at start (/usr/local/lib/node_modules/json-server/lib/cli/run.js:112:12)
at module.exports (/usr/local/lib/node_modules/json-server/lib/cli/run.js:149:3)
at module.exports (/usr/local/lib/node_modules/json-server/lib/cli/index.js:86:3)
at Object.<anonymous> (/usr/local/lib/node_modules/json-server/lib/cli/bin.js:6:14)
at Module._compile (internal/modules/cjs/loader.js:759:30) {
errno: -13,
syscall: 'open',
code: 'EACCES',
path: 'db.json'
}
error: Forever detected script exited with code: 1
i can confirm that I am running the command in the same folder as that of db.json.
I also get below warning:
warn: --minUptime not set. Defaulting to: 1000ms
warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info: Forever processing file: /usr/local/bin/json-server
I have some more logs:
Cannot bind to the port 3002. Please specify another port number either through --port argument or through the json-server.json configuration file
error: Forever detected script exited with code: 1
I have tried using other ports as well but that is also not working.

Error connecting to remote mysql through google cloud

After I run a command regarding the database, I get this:
{ SequelizeConnectionError: connect ETIMEDOUT ip:5432
at connection.connect.err (/Users/me/Documents/PetHotel/backend-sql/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:128:24)
at Connection.connectingErrorHandler (/Users/me/Documents/PetHotel/backend-sql/node_modules/pg/lib/client.js:140:14)
at Connection.emit (events.js:182:13)
at Socket.reportStreamError (/Users/me/Documents/PetHotel/backend-sql/node_modules/pg/lib/connection.js:71:10)
at Socket.emit (events.js:182:13)
at emitErrorNT (internal/streams/destroy.js:82:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
at process.internalTickCallback (internal/process/next_tick.js:72:19)
name: 'SequelizeConnectionError',
parent:
{ Error: connect ETIMEDOUT ip:5432
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1121:14)
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT',
syscall: 'connect',
address: 'ip',
port: 5432 },
original:
{ Error: connect ETIMEDOUT ip:5432
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1121:14)
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT',
syscall: 'connect',
address: 'ip',
port: 5432 } }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! app-backend# db:reset:development: `cross-env MIGRATION_ENV=development node ./migrations/reset`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the app-backend# db:reset:development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Is it something regarding google I wonder? I do have set 0.0.0.0/0 as authorised ip
From the error, it seems your app is not able to connect to CloudSQL instance possibly due to network restriction.
Opening instance to 0.0.0.0/0 is not a good idea.
Google suggest different ways yo connect to CloudSQL Instance here. One particular method is sql-proxy.
Hope these guides helps you to establish connection between your app and cloudsql.

Failed to download Chromium Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download

I am trying to install polymer-cli version 3 in my Windows and I am getting the error mentioned in this question. Searching around I reach that it is a problem with kind of PDF Generator from NPM dependencies. Sincerely, it doesn't make sense to me but I still try follow the recommendation mentioned in https://github.com/webpro/reveal-md/issues/191.
Bellow, the full error:
C:\dev\polymer2\sample>npm install -g polymer-cli#next --no-optional
C:\Users\my-user\AppData\Roaming\npm\polymer -> C:\Users\my-user\AppData\Roaming\npm\node_modules\polymer-cli\bin\poly
mer.js
> puppeteer#1.3.0 install C:\Users\my-user\AppData\Roaming\npm\node_modules\polymer-cli\node_modules\puppeteer
> node install.js
ERROR: Failed to download Chromium r549031! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.
{ Error: getaddrinfo ENOTFOUND storage.googleapis.com storage.googleapis.com:443
at errnoException (dns.js:50:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
code: 'ENOTFOUND',
errno: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'storage.googleapis.com',
host: 'storage.googleapis.com',
port: 443 }
npm WARN rollback Rolling back debug#3.1.0 failed (this is probably harmless): EPERM: operation not permitted, scandir '
C:\Users\my-user\AppData\Roaming\npm\node_modules\polymer-cli\node_modules\puppeteer\node_modules\https-proxy-agent\nod
e_modules'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.3 (node_modules\polymer-cli\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.3: wanted {"os":"darwin","arch":"any
"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: puppeteer#1.3.0 (node_modules\polymer-cli\node_modules\puppeteer):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: puppeteer#1.3.0 install: `node install.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
+ polymer-cli#1.7.0-pre.17
updated 1 package in 15.762s
C:\dev\polymer2\sample>polymer --version
1.7.0-pre.17

Compile mysql with CFI enabled

I want to compile mysql with CFI enabled by LLVM. The version of the softwares are as following:
clang-6.0
mysql-5.6.26
binutils-2.28.1
I can compile mysql successfully with the following configration:
CC="clang" CXX="clang++" CFLAGS="-g" cmake -DCMAKE_INSTALL_PREFIX=../mysql -DWITH_BOOST=./boost .
However, I can not compile mysql with the below configuration:
CC="clang" CXX="clang++" CFLAGS="-g -flto" CXXFLAGS="-g -flto" cmake -DCMAKE_INSTALL_PREFIX=../mysql -DWITH_BOOST=./boost .
The reported error is as following:
../mysys/libmysys.a: error adding symbols: Archive has no index; run ranlib to add one
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [extra/comp_err] Error 1
The ../mysys/libmysys.a is constructed by the following command:
cd /home/zhangjun/work/mysql/mysql-5.6.26/mysys_ssl
&& /home/zhangjun/tools/cmake/cmake-3.9.1-Linux-x86_64/bin/cmake -P
CMakeFiles/mysys_ssl.dir/cmake_clean_target.cmake
cd /home/zhangjun/work/mysql/mysql-5.6.26/mysys_ssl && /home/zhangjun/tools/cmake/cmake-3.9.1-Linux-x86_64/bin/cmake -E cmake_link_script CMakeFiles/mysys_ssl.dir/link.txt --verbose=1
/usr/bin/ar qc libmysys_ssl.a CMakeFiles/mysys_ssl.dir/crypt_genhash_impl.cc.o CMakeFiles/mysys_ssl.dir/my_default.cc.o CMakeFiles/mysys_ssl.dir/my_getopt.cc.o CMakeFiles/mysys_ssl.dir/my_aes.cc.o CMakeFiles/mysys_ssl.dir/my_sha1.cc.o CMakeFiles/mysys_ssl.dir/my_sha2.cc.o CMakeFiles/mysys_ssl.dir/my_md5.cc.o CMakeFiles/mysys_ssl.dir/my_rnd.cc.o CMakeFiles/mysys_ssl.dir/my_murmur3.cc.o CMakeFiles/mysys_ssl.dir/my_aes_yassl.cc.o
/usr/bin/ranlib libmysys_ssl.a
How can I fix this error?
To fix this error, I sent a email to Caroline Tice, the author of "Enforcing Forward-Edge Control-Flow Integrity in GCC & LLVM"
He said I should use the ar and runlib of llvm. The above error is fixed by using the following configuration:
CC="clang" CXX="clang++" CFLAGS="-g -flto -fvisibility=hidden -fsanitize=cfi" CXXFLAGS="-g -flto -fvisibility=hidden -fsanitize=cfi" cmake -DCMAKE_{EXE,SHARED,MODULE}_LINKER_FLAGS="-flto -fsanitize=cfi" -DCMAKE_AR=/home/zhangjun/work/llvm/llvm-3.7.1/bin/llvm-ar -DCMAKE_RANLIB=/home/zhangjun/work/llvm/llvm-3.7.1/bin/llvm-ranlib -DCMAKE_NM=/home/zhangjun/work/llvm/llvm-3.7.1/bin/llvm-nm -DCMAKE_INSTALL_PREFIX=../mysql -DWITH_BOOST=./boost .
Unfortunately, there is anotehr error:
ld: /home/zhangjun/work/llvm/llvm/tools/gold/gold-plugin.cpp:879: ld_plugin_status allSymbolsReadHook(): Assertion `ObjFilename.second' failed.
clang-6.0: error: unable to execute command: Aborted (core dumped)
clang-6.0: error: linker command failed due to signal (use -v to see invocation)
make[2]: *** [extra/comp_err] Error 254
make[2]: Leaving directory `/home/zhangjun/work/mysql/mysql-5.6.26'
make[1]: *** [extra/CMakeFiles/comp_err.dir/all] Error 2
make[1]: Leaving directory `/home/zhangjun/work/mysql/mysql-5.6.26'
make: *** [all] Error 2
Can any body help me fix this error?
Try removing -flto from the flags. For some reason, with clang, I've had the link-time optimisation cause that problem.