Errors fom making nodejs an exe file with pkg - node.js

Use the same code of last year on a new desktop, I was able to compile nodejs with pkg, but now these errors popped up.
37 error code EUSAGE
38 error
38 error Manages your package.json
38 error
38 error Usage:
38 error npm pkg set <key>=<value> [<key>=<value> ...]
38 error npm pkg get [<key> [<key> ...]]
38 error npm pkg delete <key> [<key> ...]
38 error npm pkg set [<array>[<index>].<key>=<value> ...]
38 error npm pkg set [<array>[].<key>=<value> ...]
38 error
38 error Options:
38 error [-f|--force] [--json]
38 error [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
38 error [-ws|--workspaces]
38 error
38 error Run "npm help pkg" for more info
39 verbose exit 1
40 timing npm Completed in 60ms
41 verbose code 1

Related

How to generate Typescript-Client with openapi-typescript-codegen?

When i install openapi-typescript-codegen
as described in the readme with $ npm install openapi-typescript-codegen --save-dev
it generates a package-lock.json but no package.json and no tsconfig.json. Even if i maually create the package.json and run npm run generate-client it does not work. And throws this log at me:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'generate-client' ]
2 info using npm#6.14.4
3 info using node#v10.19.0
4 verbose run-script [ 'pregenerate-client',
4 verbose run-script 'generate-client',
4 verbose run-script 'postgenerate-client' ]
5 info lifecycle frontend-api-client#1.0.0~pregenerate-client: frontend-api-client#1.0.0
6 info lifecycle frontend-api-client#1.0.0~generate-client: frontend-api-client#1.0.0
7 verbose lifecycle frontend-api-client#1.0.0~generate-client: unsafe-perm in lifecycle true
8 verbose lifecycle frontend-api-client#1.0.0~generate-client: PATH: /usr/share/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/tom/Arbeit/Frontend-API-Client/node_modules/.bin:/home/tom/.local/bin:/opt/ros/foxy/bin:/home/tom/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle frontend-api-client#1.0.0~generate-client: CWD: /home/tom/Arbeit/Frontend-API-Client
10 silly lifecycle frontend-api-client#1.0.0~generate-client: Args: [ '-c',
10 silly lifecycle 'openapi --input http://0.0.0.0:8000/openapi.json --output ./src/client --client axios' ]
11 silly lifecycle frontend-api-client#1.0.0~generate-client: Returned: code: 1 signal: null
12 info lifecycle frontend-api-client#1.0.0~generate-client: Failed to exec generate-client script
13 verbose stack Error: frontend-api-client#1.0.0 generate-client: `openapi --input http://0.0.0.0:8000/openapi.json --output ./src/client --client axios`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/share/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/share/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid frontend-api-client#1.0.0
15 verbose cwd /home/tom/Arbeit/Frontend-API-Client
16 verbose Linux 5.13.0-40-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "generate-client"
18 verbose node v10.19.0
19 verbose npm v6.14.4
20 error code ELIFECYCLE
21 error errno 1
22 error frontend-api-client#1.0.0 generate-client: `openapi --input http://0.0.0.0:8000/openapi.json --output ./src/client --client axios`
22 error Exit status 1
23 error Failed at the frontend-api-client#1.0.0 generate-client script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Im currently trying to use the tutorial from FastAPI Generate Clients.
Can anybody help me?
NPM version was to old, in the end that was the only issue.

npm install not running package "install" script

when I run npm install <package>, it seems the "install" script is not run after package install, such as puppeteer, #sentry/cli
npm i puppeteer
added 58 packages in 7s
normally, it should download a chromium binary after the package install, but nothing happened.
I don't think I set some special config in .npmrc
npm config list
; "global" config from /Users/lixiaokai/.nvm/versions/node/v12.22.1/etc/npmrc
ignore-scripts = false
; "user" config from /Users/lixiaokai/.npmrc
//registry.npmjs.org/:_authToken = (protected)
canvas_binary_host_mirror = "https://npm.taobao.org/mirrors/node-canvas-prebuilt/"
chromedriver_cdnurl = "https://npm.taobao.org/mirrors/chromedriver"
electron_mirror = "https://cdn.npm.taobao.org/dist/electron/"
fse_binary_host_mirror = "https://npm.taobao.org/mirrors/fsevents/"
phantomjs_cdnurl = "https://npm.taobao.org/mirrors/phantomjs"
puppeteer_download_host = "https://npm.taobao.org/mirrors"
registry = "https://registry.npm.taobao.org/"
sass_binary_site = "http://npm.taobao.org/mirrors/node-sass"
sharp_libvips_binary_host = "https://npm.taobao.org/mirrors/sharp-libvips"
; node bin location = /Users/lixiaokai/.nvm/versions/node/v12.22.1/bin/node
; cwd = /Users/lixiaokai/code/test
; HOME = /Users/lixiaokai
; Run `npm config ls -l` to show all defaults.
npm versoin 7.16.0
node version 12.22.1
nvm version 0.38.0
the reason why I updated my npm version is when I try to stop npm start script, it throw an error
-debug.log:
10 silly lifecycle mobile-tiku#0.0.1~start: Args: [ '-c', 'umi dev' ]
11 silly lifecycle mobile-tiku#0.0.1~start: Returned: code: 1 signal: null
12 info lifecycle mobile-tiku#0.0.1~start: Failed to exec start script
13 verbose stack Error: mobile-tiku#0.0.1 start: `umi dev`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/Users/lixiaokai/.nvm/versions/node/v12.22.1/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:314:20)
13 verbose stack at ChildProcess.<anonymous> (/Users/lixiaokai/.nvm/versions/node/v12.22.1/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:314:20)
13 verbose stack at maybeClose (internal/child_process.js:1022:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)

Running `cp` with the `-n` flag in `npm postinstall` blows up the script

Not sure why but running bower install && cp -n .env.settings.sample .env.settings && cp -n .env.private.sample .env.private as the value for postinstall in package.json blows up in NPM, whereas running the script without the -n flag works fine. It's a valid UNIX command so I'm not sure what's going on here, thanks.
Error log:
60 info lifecycle NodeTube#1.0.0~postinstall: Failed to exec postinstall script
61 verbose stack Error: NodeTube#1.0.0 postinstall: `bower install && cp -n .env.settings.sample .env.settings && cp .env.private.sample .env.private`
61 verbose stack Exit status 1
61 verbose stack at EventEmitter.<anonymous> (/Users/anthony/.nvm/versions/node/v8.17.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
61 verbose stack at emitTwo (events.js:126:13)
61 verbose stack at EventEmitter.emit (events.js:214:7)
61 verbose stack at ChildProcess.<anonymous> (/Users/anthony/.nvm/versions/node/v8.17.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
61 verbose stack at emitTwo (events.js:126:13)
61 verbose stack at ChildProcess.emit (events.js:214:7)
61 verbose stack at maybeClose (internal/child_process.js:915:16)
61 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
61 verbose stack From previous event:
61 verbose stack at runAction (/Users/anthony/.nvm/versions/node/v8.17.0/lib/node_modules/npm/lib/install/actions.js:74:13)
61 verbose stack at actions.(anonymous function) (/Users/anthony/.nvm/versions/node/v8.17.0/lib/node_modules/npm/lib/install/actions.js:50:17)
61 verbose stack at execAction (/Users/anthony/.nvm/versions/node/v8.17.0/lib/node_modules/npm/lib/install/actions.js:191:18)
61 verbose stack at withInit (/Users/anthony/.nvm/versions/node/v8.17.0/lib/node_modules/npm/lib/install/actions.js:108:12)
61 verbose stack From previous event:
61 verbose stack at withInit (/Users/anthony/.nvm/versions/node/v8.17.0/lib/node_modules/npm/lib/install/actions.js:175:13)
61 verbose stack at doOne (/Users/anthony/.nvm/versions/node/v8.17.0/lib/node_modules/npm/lib/install/actions.js:107:10)
61 verbose stack at Array.<anonymous> (/Users/anthony/.nvm/versions/node/v8.17.0/lib/node_modules/npm/node_modules/slide/lib/bind-actor.js:15:8)
61 verbose stack at LOOP (/Users/anthony/.nvm/versions/node/v8.17.0/lib/node_modules/npm/node_modules/slide/lib/chain.js:15:14)
61 verbose stack at /Users/anthony/.nvm/versions/node/v8.17.0/lib/node_modules/npm/node_modules/slide/lib/chain.js:18:7
61 verbose stack at runCallback (timers.js:810:20)
61 verbose stack at tryOnImmediate (timers.js:768:5)
61 verbose stack at processImmediate [as _immediateCallback] (timers.js:745:5)
62 verbose pkgid NodeTube#1.0.0
63 verbose cwd /Users/anthony/Development/test1/nodetube
64 verbose Darwin 18.5.0
65 verbose argv "/Users/anthony/.nvm/versions/node/v8.17.0/bin/node" "/Users/anthony/.nvm/versions/node/v8.17.0/bin/npm" "install"
66 verbose node v8.17.0
67 verbose npm v6.13.4
68 error code ELIFECYCLE
69 error errno 1
70 error NodeTube#1.0.0 postinstall: `bower install && cp -n .env.settings.sample .env.settings && cp .env.private.sample .env.private`
70 error Exit status 1
71 error Failed at the NodeTube#1.0.0 postinstall script.
71 error This is probably not a problem with npm. There is likely additional logging output above.
72 verbose exit [ 1, true ]

npm error while installing express in nodejs

I am facing a problem while npm install express. Unexpected end of JSON input while parsing near '..."dist":{"shasum":"e84' this is the erroe i am getting.
> 0 info it worked if it ends with ok
> 1 verbose cli [ 'D:\\Program Files\\nodejs\\node.exe',
> 1 verbose cli 'C:\\Users\\Rakshith Rakshak\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
> 1 verbose cli 'install',
> 1 verbose cli '-g',
> 1 verbose cli 'express' ]
> 2 info using npm#6.9.2
> 3 info using node#v10.15.3
> 4 verbose npm-session 203510227a9454ec
> 5 silly install loadCurrentTree
> 6 silly install readGlobalPackageData
> 7 http fetch GET 304 https://registry.npmjs.org/express 346ms (from cache)
> 8 silly fetchPackageMetaData error for express#latest Unexpected end of JSON input while parsing near
> '..."dist":{"shasum":"e84'
> 9 timing stage:rollbackFailedOptional Completed in 1ms
> 10 timing stage:runTopLevelLifecycles Completed in 417ms
> 11 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '..."dist":{"shasum":"e84'
> 11 verbose stack at JSON.parse (<anonymous>)
> 11 verbose stack at parseJson (C:\Users\Rakshith Rakshak\AppData\Roaming\npm\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
> 11 verbose stack at consumeBody.call.then.buffer (C:\Users\Rakshith
> Rakshak\AppData\Roaming\npm\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50)
> 11 verbose stack at process._tickCallback (internal/process/next_tick.js:68:7)
> 12 verbose cwd D:\My Files\node\role-based-auth
> 13 verbose Windows_NT 10.0.18362
> 14 verbose argv "D:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Rakshith
> Rakshak\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js"
> "install" "-g" "express"
> 15 verbose node v10.15.3
> 16 verbose npm v6.9.2
> 17 error Unexpected end of JSON input while parsing near '..."dist":{"shasum":"e84'
> 18 verbose exit [ 1, true ]
Clear NPM cache and try installing 'Express' again. Run Below command
npm cache clean --force
then install express
npm install express

Unable to install socket.io on my windows using npm

I have tried to install the socket.io on my windows 7.
I have given try to almost all installation ways. I want to make global installation using npm. I dont want to use approach of local include. I want that package installed globally.
I have attached the trail of npm-debug.log file content here. If you need complete file then tell me I can provide you.
Help will be appreciated.
203 silly lockFile 83592abd-ient-socket-io-client-0-9-16-tgz https://registry.npmjs.org/socket.io-client/-/socket.io-client-0.9.16.tgz
204 verbose lock https://registry.npmjs.org/socket.io-client/-/socket.io-client-0.9.16.tgz C:\Users\ehussain\AppData\Roaming\npm-cache\83592abd-ient-socket-io-client-0-9-16-tgz.lock
205 verbose read json C:\Users\ehussain\AppData\Roaming\npm-cache\redis\0.7.3\package\package.json
206 verbose addRemoteTarball [ 'https://registry.npmjs.org/socket.io-client/-/socket.io-client-0.9.16.tgz',
206 verbose addRemoteTarball '4da7515c5e773041d1b423970415bcc430f35fc6' ]
207 silly lockFile 10399cfa-redis-0-7-3 redis#0.7.3
208 silly lockFile 10399cfa-redis-0-7-3 redis#0.7.3
209 info retry fetch attempt 1 at 17:58:56
210 verbose fetch to= C:\Users\ehussain\AppData\Local\Temp\npm-6332\1375705736510-0.42393520870245993\tmp.tgz
211 http GET https://registry.npmjs.org/socket.io-client/-/socket.io-client-0.9.16.tgz
212 http 200 https://registry.npmjs.org/socket.io-client/-/socket.io-client-0.9.16.tgz
213 http 304 https://registry.npmjs.org/base64id/0.1.0
214 silly registry.get cb [ 304,
214 silly registry.get { server: 'CouchDB/1.3.0 (Erlang OTP/R15B03)',
214 silly registry.get etag: '"CTLQBM2XI54YVEFGWA4X7AK4Y"',
214 silly registry.get date: 'Mon, 05 Aug 2013 12:29:04 GMT',
214 silly registry.get 'content-length': '0' } ]
215 verbose etag base64id/0.1.0 from cache
216 verbose read json C:\Users\ehussain\AppData\Roaming\npm-cache\base64id\0.1.0\package\package.json
217 silly lockFile b2185bf4-base64id-0-1-0 base64id#0.1.0
218 silly lockFile b2185bf4-base64id-0-1-0 base64id#0.1.0
219 silly shasum updated bytes 65536
220 silly shasum updated bytes 65536
221 silly shasum updated bytes 65536
222 silly shasum updated bytes 65536
223 silly shasum updated bytes 65536
224 silly shasum updated bytes 65536
225 silly shasum updated bytes 65536
226 silly shasum updated bytes 65536
227 silly shasum updated bytes 65536
228 silly shasum updated bytes 65536
229 silly shasum updated bytes 65536
230 silly shasum updated bytes 65536
231 silly shasum updated bytes 65536
232 silly shasum updated bytes 65536
233 silly shasum updated bytes 65536
234 silly shasum updated bytes 30201
235 info shasum ab2e3004bdbd9f9e1023846ebad926c5e2f162cd
235 info shasum C:\Users\ehussain\AppData\Local\Temp\npm-6332\1375705736510-0.42393520870245993\tmp.tgz
236 silly lockFile 83592abd-ient-socket-io-client-0-9-16-tgz https://registry.npmjs.org/socket.io-client/-/socket.io-client-0.9.16.tgz
237 silly lockFile 83592abd-ient-socket-io-client-0-9-16-tgz https://registry.npmjs.org/socket.io-client/-/socket.io-client-0.9.16.tgz
238 silly lockFile c81dc0af-socket-io-client-0-9-16 socket.io-client#0.9.16
239 silly lockFile c81dc0af-socket-io-client-0-9-16 socket.io-client#0.9.16
240 verbose about to build C:\Users\ehussain\AppData\Roaming\npm\node_modules\socket.io
241 info C:\Users\ehussain\AppData\Roaming\npm\node_modules\socket.io unbuild
242 verbose from cache C:\Users\ehussain\AppData\Roaming\npm\node_modules\socket.io\package.json
243 info preuninstall socket.io#0.9.16
244 info uninstall socket.io#0.9.16
245 verbose true,C:\Users\ehussain\AppData\Roaming\npm\node_modules,C:\Users\ehussain\AppData\Roaming\npm\node_modules unbuild socket.io#0.9.16
246 info postuninstall socket.io#0.9.16
247 error Error: shasum check failed for C:\Users\ehussain\AppData\Local\Temp\npm-6332\1375705736510-0.42393520870245993\tmp.tgz
247 error Expected: 4da7515c5e773041d1b423970415bcc430f35fc6
247 error Actual: ab2e3004bdbd9f9e1023846ebad926c5e2f162cd
247 error at D:\Work\Nodejs\node\node_modules\npm\lib\utils\sha.js:29:20
247 error at ReadStream.<anonymous> (D:\Work\Nodejs\node\node_modules\npm\lib\utils\sha.js:49:5)
247 error at ReadStream.EventEmitter.emit (events.js:117:20)
247 error at _stream_readable.js:870:14
247 error at process._tickCallback (node.js:415:13)
248 error If you need help, you may report this log at:
248 error <http://github.com/isaacs/npm/issues>
248 error or email it to:
248 error <npm-#googlegroups.com>
249 error System Windows_NT 6.1.7601
250 error command "D:\\Work\\Nodejs\\node\\\\node.exe" "D:\\Work\\Nodejs\\node\\node_modules\\npm\\bin\\npm-cli.js" "install" "socket.io" "-g"
251 error cwd D:\Work\Nodejs\node
252 error node -v v0.10.0
253 error npm -v 1.2.14
254 verbose exit [ 1, true ]
Tried it with npm 1.3 and works.
Try clearing npm cache with
npm cache clean
Hope that helps.
when all else fails, clear you cache

Resources