pm2-installer icon indicating copy to clipboard operation
pm2-installer copied to clipboard

Error while npm run config

Open agrosjea opened this issue 4 years ago • 2 comments

Description I am having a cache error while installing on a production system without internet

Steps to Reproduce

  1. on my dev computer
  • npm run bundle
  1. I zipped the entire repo and copied to my prod computer, then unzipped...
  2. In an admin powershell terminal
  • npm run configure
  • npm run setup

I'm getting the following install log :

> [email protected] setup C:\users\xxx\Desktop\pm2-installer
> node ./src/tools/script-for-os.js


> [email protected] setup:windows C:\users\xxx\Desktop\pm2-installer
> PowerShell -NoProfile -ExecutionPolicy Bypass src\windows\setup.ps1

=== Setup ===
=== Checking npm Configuration ===
Global npm prefix location appears valid: C:\ProgramData\npm\npm
Global npm cache location appears valid: C:\ProgramData\npm\npm-cache
=== Checking npm Configuration Complete ===
=== Install Packages ===
Running on: 9/9/2020, pm2-installer 3.0.2 with node v10.19.0 and npm 6.13.4 on win32-10.0.16299.
Using:
 [email protected]
 [email protected]
 [email protected]
Checking connectivity to the npm registry..
Could not connect to registry.npmjs.org: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
Cannot connect to the npm registry. Checking for offline bundle..
Cache tar bundle detected. Decompressing..
Decompressing .\bundle.tar.gz took 3 seconds.
Bundled on: 9/9/2020, pm2-installer 3.0.2 with node v10.19.0 and npm 6.13.4 on win32-10.0.17763.
WARNING: Bundle was created on win32-10.0.17763 but this is win32-10.0.16299.
v Offline install bundle appears valid.
Cache verified and compressed (C:\users\xxx\Desktop\pm2-installer\.npm_cache\_cacache):
Content verified: 378 (9515873 bytes)
Index entries: 576
Finished in 0.446s
Installing packages..
npm ERR! code ENOTCACHED
npm ERR! request to https://registry.npmjs.org/pm2 failed: cache mode is 'only-if-cached' but no cached response available.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\users\xxx\Desktop\pm2-installer\.npm_cache\_logs\2020-09-09T00_42_40_628Z-debug.log
npm ERR! code ENOTCACHED
npm ERR! request to https://registry.npmjs.org/pm2-logrotate failed: cache mode is 'only-if-cached' but no cached response available.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\users\xxx\Desktop\pm2-installer\.npm_cache\_logs\2020-09-09T00_42_41_337Z-debug.log
npm ERR! code ENOTCACHED
npm ERR! request to https://registry.npmjs.org/node-windows failed: cache mode is 'only-if-cached' but no cached response available.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\users\xxx\Desktop\pm2-installer\.npm_cache\_logs\2020-09-09T00_42_42_047Z-debug.log
Installing packages took 2 seconds.
Linking node-windows..
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/node-windows failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\ProgramData\npm\npm-cache\_logs\2020-09-09T00_42_42_772Z-debug.log
=== Install Packages Complete: took 9 seconds ===
=== Creating Service ===
Determining pm2 installation directory..
Determining Local Service user name ("S-1-5-19")..
Configuration:
  PM2_HOME:              C:\ProgramData\pm2\home
  PM2_SERVICE_DIRECTORY: C:\ProgramData\pm2\service
  PM2_INSTALL_DIRECTORY: C:\ProgramData\npm\npm\node_modules\pm2
  Service User:          NT AUTHORITY\LOCAL SERVICE

Attempting to create "C:\ProgramData\pm2\home"
Directory "C:\ProgramData\pm2\home" already exists, no need to create it.
Attempting to create "C:\ProgramData\pm2\service"
Directory "C:\ProgramData\pm2\service" already exists, no need to create it.
Copying service files from ".\src\windows\service\" to "C:\ProgramData\pm2\service"..
Copying files complete.
Attempting to grant "NT AUTHORITY\LOCAL SERVICE" full permissions to "C:\ProgramData\pm2\home".
Successfully set permissions on "C:\ProgramData\pm2\home".
Attempting to grant "NT AUTHORITY\LOCAL SERVICE" full permissions to "C:\ProgramData\pm2\service".
Successfully set permissions on "C:\ProgramData\pm2\service".
Running Node service install script..
service-management\install Installing
Could not load "node-windows", likely because it has already been uninstalled.
Attempting to grant "NT AUTHORITY\LOCAL SERVICE" full permissions to "C:\ProgramData\pm2\home".
Successfully set permissions on "C:\ProgramData\pm2\home".
Attempting to grant "NT AUTHORITY\LOCAL SERVICE" full permissions to "C:\ProgramData\pm2\service".
Successfully set permissions on "C:\ProgramData\pm2\service".
Updating "pm2.exe" service to run as "NT AUTHORITY\LocalService"
Attempt #2 to locate "pm2.exe" service..
Attempt #3 to locate "pm2.exe" service..
Attempt #4 to locate "pm2.exe" service..
Attempt #5 to locate "pm2.exe" service..
Attempt #6 to locate "pm2.exe" service..
Attempt #7 to locate "pm2.exe" service..
Attempt #8 to locate "pm2.exe" service..
Attempt #9 to locate "pm2.exe" service..
Attempt #10 to locate "pm2.exe" service..
Could not find "pm2.exe" service after 10 attempts.
At C:\users\xxx\Desktop\pm2-installer\src\windows\setup-service.ps1:124 char:5
+     throw "Could not find `"$name`" service after $maxAttempts attemp ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Could not find ...er 10 attempts.:String) [], RuntimeException
    + FullyQualifiedErrorId : Could not find "pm2.exe" service after 10 attempts.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] setup:windows: `PowerShell -NoProfile -ExecutionPolicy Bypass src\windows\setup.ps1`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] setup:windows 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:\ProgramData\npm\npm-cache\_logs\2020-09-09T00_42_53_870Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] setup: `node ./src/tools/script-for-os.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] setup 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:\ProgramData\npm\npm-cache\_logs\2020-09-09T00_42_53_899Z-debug.log

Environment Running on: 9/9/2020, pm2-installer 3.0.2 with node v10.19.0 and npm 6.13.4 on win32-10.0.16299.

agrosjea avatar Sep 09 '20 00:09 agrosjea

FYI it succeed when I tried to run the following on the machine where I packaged :

  • npm run configure
  • npm run setup

Like if target system couldn't see the cache 🤔

The log is as follow when I install in my dev environment.

> [email protected] configure C:\Users\xxx\Desktop\SRC\pm2-installer
> node ./src/tools/script-for-os.js


> [email protected] configure:windows C:\Users\xxx\Desktop\SRC\pm2-installer
> PowerShell -NoProfile -ExecutionPolicy Bypass src\windows\configure-setup.ps1

=== Configuring npm to use C:\ProgramData\npm ===
Directory C:\ProgramData\npm already exists, no need to create it.
Directory C:\ProgramData\npm\npm already exists, no need to create it.
Directory C:\ProgramData\npm\npm\node_modules already exists, no need to create it.
Directory C:\ProgramData\npm\npm-cache already exists, no need to create it.
npm prefix config is already set to C:\ProgramData\npm\npm, no need to update it.
npm cache config is already set to C:\ProgramData\npm\npm-cache, no need to update it.
Path does not contain C:\ProgramData\npm\npm. Adding it..
=== Configuring npm Complete ===
PS C:\Users\xxx\Desktop\SRC\pm2-installer> npm run setup

> [email protected] setup C:\Users\xxx\Desktop\SRC\pm2-installer
> node ./src/tools/script-for-os.js


> [email protected] setup:windows C:\Users\xxx\Desktop\SRC\pm2-installer
> PowerShell -NoProfile -ExecutionPolicy Bypass src\windows\setup.ps1

=== Setup ===
=== Checking npm Configuration ===
Global npm prefix location appears valid: C:\ProgramData\npm\npm
Global npm cache location appears valid: C:\ProgramData\npm\npm-cache
=== Checking npm Configuration Complete ===
=== Install Packages ===
Running on: 9/8/2020, pm2-installer 3.0.2 with node v10.19.0 and npm 6.13.4 on win32-10.0.17763.
Using:
 [email protected]
 [email protected]
 [email protected]
Checking connectivity to the npm registry..
Could not connect to registry.npmjs.org: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
Cannot connect to the npm registry. Checking for offline bundle..
Cache tar bundle detected. Decompressing..
Decompressing .\bundle.tar.gz took 1 seconds.
Bundled on: 9/8/2020, pm2-installer 3.0.2 with node v10.19.0 and npm 6.13.4 on win32-10.0.17763.
√ Offline install bundle appears valid.
Cache verified and compressed (~\Desktop\SRC\pm2-installer\.npm_cache\_cacache):
Content verified: 378 (9515873 bytes)
Index entries: 576
Finished in 1.124s
Installing packages..
C:\ProgramData\npm\npm\pm2-dev -> C:\ProgramData\npm\npm\node_modules\pm2\bin\pm2-dev
C:\ProgramData\npm\npm\pm2 -> C:\ProgramData\npm\npm\node_modules\pm2\bin\pm2
C:\ProgramData\npm\npm\pm2-docker -> C:\ProgramData\npm\npm\node_modules\pm2\bin\pm2-docker
C:\ProgramData\npm\npm\pm2-runtime -> C:\ProgramData\npm\npm\node_modules\pm2\bin\pm2-runtime
+ [email protected]
added 186 packages from 191 contributors in 4.288s
+ [email protected]
added 210 packages from 239 contributors in 6.353s
+ [email protected]
added 5 packages from 8 contributors in 0.252s
Installing packages took 15 seconds.
Linking node-windows..
C:\Users\xxx\Desktop\SRC\pm2-installer\node_modules\node-windows -> C:\ProgramData\npm\npm\node_modules\node-windows
Unblocking script at C:\ProgramData\npm\npm\pm2.ps1..
=== Install Packages Complete: took 23 seconds ===
=== Creating Service ===
Determining pm2 installation directory..
Determining Local Service user name ("S-1-5-19")..
Configuration:
  PM2_HOME:              C:\ProgramData\pm2\home
  PM2_SERVICE_DIRECTORY: C:\ProgramData\pm2\service
  PM2_INSTALL_DIRECTORY: C:\ProgramData\npm\npm\node_modules\pm2
  Service User:          NT AUTHORITY\LOCAL SERVICE

Attempting to create "C:\ProgramData\pm2\home"
Directory "C:\ProgramData\pm2\home" does not exist, creating it..
Attempting to create "C:\ProgramData\pm2\service"
Directory "C:\ProgramData\pm2\service" does not exist, creating it..
Copying service files from ".\src\windows\service\" to "C:\ProgramData\pm2\service"..
Copying files complete.
Attempting to grant "NT AUTHORITY\LOCAL SERVICE" full permissions to "C:\ProgramData\pm2\home".
Successfully set permissions on "C:\ProgramData\pm2\home".
Attempting to grant "NT AUTHORITY\LOCAL SERVICE" full permissions to "C:\ProgramData\pm2\service".
Successfully set permissions on "C:\ProgramData\pm2\service".
Running Node service install script..
service-management\install Installing
Installing service "PM2" at "C:\ProgramData\pm2\service"
service-management\install Complete
Attempting to grant "NT AUTHORITY\LOCAL SERVICE" full permissions to "C:\ProgramData\pm2\home".
Successfully set permissions on "C:\ProgramData\pm2\home".
Attempting to grant "NT AUTHORITY\LOCAL SERVICE" full permissions to "C:\ProgramData\pm2\service".
Successfully set permissions on "C:\ProgramData\pm2\service".
Updating "pm2.exe" service to run as "NT AUTHORITY\LocalService"
Found "pm2.exe" service:
  State: Stopped
  Status: OK
  Started: False
  Start Mode: Auto
  Service Type: Own Process
  Start Name: LocalSystem
Changing service user account..
Starting service..
  State is now: Start Pending
  State is now: Running
Service "pm2.exe" is now running as "NT AUTHORITY\LocalService".
Waiting a moment to confirm the"pm2.exe" service..
Service "pm2.exe":
  State: Running
  Status: OK
  Started: True
  Start Mode: Auto
  Service Type: Own Process
  Start Name: NT AUTHORITY\LocalService

agrosjea avatar Sep 09 '20 01:09 agrosjea

It's 4 years later bit did you figure it out?

Healyhatman avatar Feb 26 '24 09:02 Healyhatman