Tutorial nextjs multiple apps - reactjs

I tried :
https://github.com/zeit/next.js/tree/canary/examples/with-zones
I follow the instructions and I got this :
#MacBook-Pro  ~/Documents/nextjs  cd with-zones
#MacBook-Pro  ~/Documents/nextjs/with-zones  now dev
> Now CLI 16.7.3 dev (beta) — https://zeit.co/feedback
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ WARN! You defined 1 build that did not match any source files (please ensure they are NOT defined in .nowignore): │
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
- {"src":"home/next.config.js","use":"#now/next"}
> Creating initial build
Exiting builder due to build error:
Error: Cannot find module 'next'
Require stack:
- /Users/d_/Documents/nextjs/with-zones/blog/noop.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
at resolveFileName (/Users/d_/Library/Caches/co.zeit.now/dev/builders/node_modules/#now/next/dist/dev-server.js:142:39)
at resolveFrom (/Users/d_/Library/Caches/co.zeit.now/dev/builders/node_modules/#now/next/dist/dev-server.js:156:9)
at Object.module.exports.101.module.exports [as default] (/Users/d_/Library/Caches/co.zeit.now/dev/builders/node_modules/#now/next/dist/dev-server.js:159:47)
at process.<anonymous> (/Users/d_/Library/Caches/co.zeit.now/dev/builders/node_modules/#now/next/dist/dev-server.js:4472:48)
at Object.onceWrapper (events.js:313:26)
at process.emit (events.js:223:5)
at emit (internal/child_process.js:876:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/Users/d_/Documents/nextjs/with-zones/blog/noop.js' ]
What is the problem ? I don't understand... thanks

Related

Build error when building react app on vercel

when I was trying to deploy a react app on vercel I'm getting this error message
[12:54:56.889] Cloning github.com/<project name> (Branch: main, Commit: 377f238)
[12:54:56.897] The cli flag --force was set. Skipping build cache download.
[12:54:58.099] Cloning completed: 1.210s
[12:54:58.100] Running "code 0"
[12:54:58.105] /bin/sh: code: command not found
[12:54:58.111] Error: Command failed with exit code 127: code 0
[12:54:58.112] at zZe (/var/task/sandbox.js:293:57)
[12:54:58.112] at /var/task/sandbox.js:293:9994
[12:54:58.112] at processTicksAndRejections (internal/process/task_queues.js:95:5) {
[12:54:58.112] shortMessage: 'Command failed with exit code 127: code 0',
[12:54:58.112] command: 'code 0',
[12:54:58.113] exitCode: 127,
[12:54:58.113] signal: undefined,
[12:54:58.113] signalDescription: undefined,
[12:54:58.113] stdout: undefined,
[12:54:58.113] stderr: undefined,
[12:54:58.113] failed: true,
[12:54:58.115] timedOut: false,
[12:54:58.115] isCanceled: false,
[12:54:58.115] killed: false
[12:54:58.115] }
Until the last build, it was building successfully when I was trying to build from a GitHub commit.
I don't have any idea what happens behind it. there is a possibility that I updated my node version on my local machine.

events.js:288 Error: write EPIPE when executing tests with Jest

I have a problem when setting React Testing Library into a new project, which is a project that generates common UI components for several projects. In one of the projects it is correctly setup, but when I added React Testing Library and updated dependencies in this project, I am able to run a test but not all of them.
If I do yarn test this is the result:
Test Suites: 8 passed, 8 of 33 total
Tests: 84 passed, 84 total
Snapshots: 0 total
Time: 28 sevents.js:288
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at ChildProcess.target._send (internal/child_process.js:806:20)
at ChildProcess.target.send (internal/child_process.js:677:19)
at ChildProcessWorker.send (C:\Users\user\workspace\project\node_modules\jest-worker\build\workers\ChildProcessWorker.js:291:17)
at WorkerPool.send (C:\Users\user\workspace\project\node_modules\jest-worker\build\WorkerPool.js:32:34)
at Farm._process (C:\Users\user\workspace\project\node_modules\jest-worker\build\Farm.js:129:10)
at Farm._enqueue (C:\Users\user\workspace\project\node_modules\jest-worker\build\Farm.js:152:10)
at Farm._push (C:\Users\user\workspace\project\node_modules\jest-worker\build\Farm.js:159:12)
at C:\Users\user\workspace\project\node_modules\jest-worker\build\Farm.js:90:14
at new Promise (<anonymous>)
at Farm.doWork (C:\Users\user\workspace\project\node_modules\jest-worker\build\Farm.js:56:12)
Emitted 'error' event on ChildProcess instance at:
at internal/child_process.js:810:39
at processTicksAndRejections (internal/process/task_queues.js:79:11) {
errno: 'EPIPE',
code: 'EPIPE',
syscall: 'write'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I tried doing rm -rf node_modules and then cleaning cache, and didn't work.
Any help?
It turns out that by changing some libraries in package.json the error dissapears:
Before (KO):
"babel-jest": "^24.9.0",
"jest": "^26.0.1",
After (OK):
"babel-jest": "^26.0.1",
"jest": "^25.5.4",
By doing yarn cache clean solved my problem. If you met pipe error similar like image below. I believe it is related to memory leaks.
In my case was the version of node. I had the version 15 (from Latest Features) and changed it to the stable version 14.17.3 (from LTS).
To know which version you have use node -v in a terminal.

when generating build of AngularJS project getting Uglifying source .tmp/concat/scripts/scripts.js failed

Creating build of angularjs project inside folder dist /script I am not getting one script.js file.
I have tried grunt build --prod --force command for creating the build
Running "uglify:generated" (uglify) task
JS_Parse_Error {enter code here
message: 'Unexpected token: punc ())',
filename: '../../.tmp/concat/scripts/scripts.js',
line: 5122,
col: 59,
pos: 161138,
stack:
'Error\n at new JS_Parse_Error (D:\\...node_modules\\uglify-node_modules\\uglify-js\\lib\\parse.js:1427:20)' }
>> Uglifying source .tmp/concat/scripts/scripts.js failed.
Warning: Uglification failed.
Unexpected token: punc ()).
Line 5122 in .tmp/concat/scripts/scripts.jsenter code here
Used --force, continuing.
Warning: Cannot read property min of undefined Used --enter code hereforce, continuing.

gulp css:watch exited with code null

I installed this library:
npm install --save-dev css-loader
https://github.com/webpack-contrib/css-loader
now, when I want to run my project I got this errors:
yarn start
yarn run v1.5.1
$ cross-env NODE_PATH=./app concurrently --kill-others "node app/server" "gulp css:watch"
[1] [10:00:19]
[1] Using gulpfile ~/Desktop/react js/shadyab/gulpfile.js
[1] [10:00:19] Starting 'css'...
[1] [10:00:19]
[1] Finished 'css' after 320 ms
[1] [10:00:19] Starting 'css:watch'...
[1] [10:00:19]
[1] Finished 'css:watch' after 9.38 ms
[0] Server is listening to port: 3000
[0] events.js:183
[0] throw er; // Unhandled 'error' event
[0] ^
[0]
[0] Error: listen EADDRINUSE :::3000
[0] at Object._errnoException (util.js:1022:11)
[0] at _exceptionWithHostPort (util.js:1044:20)
[0] at Server.setupListenHandle [as _listen2] (net.js:1367:14)
[0] at listenInCluster (net.js:1408:12)
[0] at Server.listen (net.js:1492:7)
[0] at Function.listen (/Users/sm_emamian/Desktop/react js/shadyab/node_modules/express/lib/application.js:618:24)
[0] at Object.<anonymous> (/Users/sm_emamian/Desktop/react js/shadyab/app/server/server.js:73:8)
[0] at Module._compile (module.js:652:30)
[0] at loader (/Users/sm_emamian/Desktop/react js/shadyab/node_modules/babel-register/lib/node.js:144:5)
[0] at Object.require.extensions.(anonymous function) [as .js] (/Users/sm_emamian/Desktop/react js/shadyab/node_modules/babel-register/lib/node.js:154:7)
[0] node app/server exited with code 1
--> Sending SIGTERM to other processes..
[1] gulp css:watch exited with code null
error An unexpected error occurred: "Command failed.
Exit code: 1
Command: sh
Arguments: -c cross-env NODE_PATH=./app concurrently --kill-others \"node app/server\" \"gulp css:watch\"
Directory: /Users/sm_emamian/Desktop/react js/shadyab
Output:
".
info If you think this is a bug, please open a bug report with the information provided in "/Users/sm_emamian/Desktop/react js/shadyab/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

error LNK2001 occured when node.js addone call a function in c static library

I found a problem when i wrote a node.js add-on. The description of the problem is:
I have built a static library (a lib file, named cshmdb.lib) from a C project. When I used it in a node.js's add-on project, it gave the error LNK2001 when building. But when i don't used the lib file, and put all the C file into the node.js's add-on project, it built successfully.
The configuration of gpy when error occured is as follow:
{
"targets" : [
{
"target_name" : "shmdb",
"include_dirs" : [
"include", "./include"
],
'libraries' : [
'../lib/cshmdb.lib'
],
"sources" : ["addon.cc", "ShmdbObject.cc"]
}
]
}
The build error:
正在创建库 D:\temp\addone\cpp2node\build\Release\shmdb.lib 和对象 D:\temp\addone\cpp2node\build\Release\shmdb.exp
ShmdbObject.obj : error LNK2001: 无法解析的外部符号 shmdb_initParent [D:\temp\addone\cpp2node\build\shmdb.vcxproj]
D:\temp\addone\cpp2node\build\Release\shmdb.node : fatal error LNK1120: 1 个无法解析的外部命令 [D:\temp\addone\cpp2node\build\shmdb.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\sunny\AppData\Roaming\npm\no
de_modules\node-gyp\lib\build.js:267:23)
My directory structure:
cpp2node
----include
----mm.h
----lib
----cshmdb.lib
----addone.cc
----building.gpy
----ShmdbObject.cc
----ShmdbObject.h
In addition , I wrote a test win32 console project and call the lib file cshmdb.lib in vs2012,and it built successfully. I guess that something was wrong when i configure the gpy, but I can't find the reason.

Resources