Deploying Ghost 0.4.2 to Azure Site using Git Deploy - node.js

I'm trying to upgrade my really simply ghost test site to the latest version of Ghost 0.4.2. I've followed the upgrade instructions on their website and am able to run the upgraded version of the project locally.
When I try to push the upgrade version to my azure instance using the GIT Deploy process I'm getting the following error log. Can anyone shed some light on what's going wrong. My best guess is that their is something wrong with the new version of sqlite.
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling node.js deployment.
KuduSync.NET from: 'D:\home\site\repository' to: 'D:\home\site\wwwroot'
Copying file: 'iisnode.yml'
Copying file: 'package.json'
Node.js versions available on the platform are: 0.6.17, 0.6.20, 0.8.2, 0.8.19, 0.8.26, 0.10.5, 0.10.18, 0.10.21, 0.10.24, 0.10.26, 0.10.28.
Selected node.js version 0.10.28. Use package.json file to choose a different version.
Updating iisnode.yml at D:\home\site\wwwroot\iisnode.yml
npm http GET https://registry.npmjs.org/sqlite3
npm http 304 https://registry.npmjs.org/sqlite3
npm ERR! error rolling back Error: EPERM, unlink 'D:\home\site\wwwroot\node_modules\sqlite3\lib\binding\Release\node-v11-win32-ia32\node_sqlite3.node'
Failed exitCode=50, command="D:\Program Files (x86)\nodejs\0.10.28\node.exe" "D:\Program Files (x86)\npm\1.4.9\node_modules\npm\bin\npm-cli.js" install --production
npm ERR! error rolling back sqlite3#2.2.0 { [Error: EPERM, unlink 'D:\home\site\wwwroot\node_modules\sqlite3\lib\binding\Release\node-v11-win32-ia32\node_sqlite3.node']
An error has occurred during web site deployment.
npm ERR! error rolling back errno: 50,
npm ERR! error rolling back code: 'EPERM',
npm ERR! error rolling back path: 'D:\\home\\site\\wwwroot\\node_modules\\sqlite3\\lib\\binding\\Release\\node-v11-win32-ia32\\node_sqlite3.node' }
npm ERR! Error: EPERM, unlink 'D:\home\site\wwwroot\node_modules\sqlite3\lib\binding\Release\node-v11-win32-ia32\node_sqlite3.node'
npm ERR! { [Error: EPERM, unlink 'D:\home\site\wwwroot\node_modules\sqlite3\lib\binding\Release\node-v11-win32-ia32\node_sqlite3.node']
npm ERR! errno: 50,
npm ERR! code: 'EPERM',
npm ERR! path: 'D:\\home\\site\\wwwroot\\node_modules\\sqlite3\\lib\\binding\\Release\\node-v11-win32-ia32\\node_sqlite3.node' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "D:\\Program Files (x86)\\nodejs\\0.10.28\\node.exe" "D:\\Program Files (x86)\\npm\\1.4.9\\node_modules\\npm\\bin\\npm-cli.js" "install" "--production"
npm ERR! cwd D:\home\site\wwwroot
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! path D:\home\site\wwwroot\node_modules\sqlite3\lib\binding\Release\node-v11-win32-ia32\node_sqlite3.node
npm ERR! code EPERM
npm ERR! errno 50
npm ERR! stack Error: EPERM, unlink 'D:\home\site\wwwroot\node_modules\sqlite3\lib\binding\Release\node-v11-win32-ia32\node_sqlite3.node'

I think this is related to the file in question ...\node_sqlite3.node being locked. When faced with the same error I've restarted Azure Website and redeployed, it worked the second time.
I know, not exactly a root cause solution, but will get you up and running if you're stuck.

I had the same problem. I found that my Git repo had the node_modules folder included so this was being deployed along with the code. This isn't needed - Kudu will build the dependencies at deploy time.
Try removing the node_modules folder from your repo, and stick an entry in your .gitignore so that it doesn't get re-added. You'll also want to do the same for your Ghost.db and any other bits of content that shouldn't get replaced at deploy time.

Related

Unable to update npm from 6.14.8 to 7.3; deleting npm.cmd, npx.cmd, and npm leads to more errors

I've been attempting to update my npm globally using the npm install -g npm command in Git Bash to keep it current with Angular 11 and Node.js version 15.5.0. I receive the following error:
npm ERR! code EEXIST
npm ERR! path C:\Program Files\nodejs\npm.cmd
npm ERR! Refusing to delete C:\Program Files\nodejs\npm.cmd: is outside C:\Program Files\nodejs\node_modules\npm and not a link
npm ERR! File exists: C:\Program Files\nodejs\npm.cmd
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
I deleted the file from nodejs and attempted to install again, but received another error about the npx.cmd. I deleted that file, attempt installation, and received an error about the npm file.
npm ERR! code EEXIST
npm ERR! path C:\Program Files\nodejs\npx.cmd
npm ERR! Refusing to delete C:\Program Files\nodejs\npx.cmd: is outside C:\Program Files\nodejs\node_modules\npm and not a link
npm ERR! File exists: C:\Program Files\nodejs\npx.cmd
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! code EEXIST
npm ERR! path C:\Program Files\nodejs\npm
npm ERR! Refusing to delete C:\Program Files\nodejs\npm: is outside C:\Program Files\nodejs\node_modules\npm and not a link
npm ERR! File exists: C:\Program Files\nodejs\npm
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
After deleting them and attempting to install npm again, Git Bash no longer finds npm. The installation never starts.
bash: /c/Program Files/nodejs/npm: No such file or directory
I tried to delete the npm file from my roaming folder in AppData, but received the following error:
npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path C:\Users\Yoga 2 Mitchell\AppData\Roaming\npm
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\Yoga 2 Mitchell\AppData\Roaming\npm'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
I've also tried the following at different times:
Delete node_modules and reinstall npm
Used npm 7.3.0's Git repository to create a new npm file (?) (I will need to find the suggestion online again to clarify/provide more specifics)
Clean caches
Uninstall and reinstall Angular 11 CLI and Node.js (tried for both LTS and Current version)
Nothing has worked so far. The second method I tried in the above list was able to update it to 6.14.10, but this attempt returned errors that seemed to affect Angular. I reverted everything to the original state to be safe. Please let me know if I can clarify anything else regarding my issue.
I connected with another developer about the errors I've been receiving. The following approach was suggested, and it works for fixing the problem for LTS: How to completely remove node.js from Windows
The LTS version allowed me to update to npm's 6.14.11, but when I tried this approach to install the Current version, it stayed 6.14.11. Hopefully, this approach helps others who are experiencing similar errors.

Unable to install angular cli with npm errno -4048 package.json

I tried installing angular cli with npm. But I'm getting the below error while executing the command npm install -g #angular/cli.
I am not executing this command as admin, but as a user.
D:\AngularWorkstation>npm install -g #angular/cli
npm WARN sass-loader#6.0.6 requires a peer of node-sass#^4.0.0 but none is installed. You must install peer dependencies yourself.
npm ERR! path **D:\node_modules\node_modules\#angular\cli\node_modules\which\package.json.365294863
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename 'D:\node_modules\node_modules\#angular\cli\node_modules\which\package.json.365294863' -> 'D:\node_modules\node_modules\#angular\cli\node_modules\which\package.json'
npm ERR! { Error: EPERM: operation not permitted, rename 'D:\node_modules\node_modules\#angular\cli\node_modules\which\package.json.365294863' -> 'D:\node_modules\node_modules\#angular\cli\node_modules\which\package.json'
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, rename 'D:\node_modules\node_modules\#angular\cli\node_modules\which\package.json.365294863' ->** 'D:\node_modules\node_modules\#angular\cli\node_modules\which\package.json'
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'D:\\node_modules\\node_modules\\#angular\\cli\\node_modules\\which\\package.json.365294863',
npm ERR! dest: 'D:\\node_modules\\node_modules\\#angular\\cli\\node_modules\\which\\package.json' },
npm ERR! stack: 'Error: EPERM: operation not permitted, rename \'D:\\node_modules\\node_modules\\#angular\\cli\\node_modules\\which\\package.json.365294863\' -> \'D:\\node_modules\\node_modules\\#angular\\cli\\node_modules\\which\\package.json\'',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'D:\\node_modules\\node_modules\\#angular\\cli\\node_modules\\which\\package.json.365294863',
npm ERR! dest: 'D:\\node_modules\\node_modules\\#angular\\cli\\node_modules\\which\\package.json',
npm ERR! parent: '#angular/cli' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\techno\AppData\Roaming\npm-cache\_logs\2018-01-03T09_14_35_602Z-debug.log
*PS : I'm using Windows10 OS. I also tried changing the npm global path to'D:\node_modules' to check if it's due to permission issue. However the output is the same.
node --version : v7.7.2
npm --version : 4.1.2*
I had a similar issue when trying to install Yeoman with npm on Windows 10. The culprit turned out to be the McAfee AV software that was installed on my machine.
McAfee seemed to be scanning the changes that npm was trying to make to a json file and as part of the scanning routine, prevented the rename from occurring. This resulted in a 4048 error being raised by npm similar to the error in your output.
To get around this I:
Uninstalled McAfee and restarted my machine so that it reverted to Microsoft's built-in security software.
Re-ran the npm install command and it worked correctly.
Alternatively, you could change the settings of your AV software to not actively check file changes for the node_modules folder. This would hopefully allow your AV software to stay installed and the npm command to work too.
From your error logs, It seems that there is some permission issue while installing the packages. You can specifically resolve this issue by two ways.
1) If you are trying to install the packages globally then you have to run the npm install <pkg_name> -g command with the administrative user or using sudo npm install <pkg_name> -g command.
To install the npm-packages globally you can follow the steps below:
Run the command prompt as the administrative user.
Run npm install <pkg_name> -g.
2) You should try going to the top-level folder in Windows Explorer, right-click on "get more info" option then go down to the permissions section, give yourself all permissions, and tell it to apply them recursively.
Or simply you can go to specified npm working directory and edit to permission section and allow all the permission to the current user and also change the owner to itself for all the recursive directories as well.
Then boot up Windows again.
Note: If you are installing an npm-package locally, then you should be in your local project directory and can try running sudo npm install <pkg-name> command to install required package. the purpose of using sudo is that it will change your owner permissions so you can make your current user authorized to run npm commands.
I'd recommend you to take a look at https://docs.npmjs.com/getting-started/fixing-npm-permissions
1) uninstall node
2) download latest version of node from [https://nodejs.org/en/][1] .
3) install node js

IBM Mobile First - mfpdev-cli Installation Failure

I have issue while installing npm mfpdev-cli (IBM Mobile First CLI).
I am using node v 6.11.2 npm v 5.4.1
I am unable to install mfpdev-cli. I am getting the below error:
Error message:
npm ERR! path /Users/divya/Desktop/MFP/mdo-windows-support/package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno -2
npm ERR! syscall open
npm ERR! package.json ENOENT: no such file or directory, open '/Users/divya/Desktop/MFP/mdo-windows-support/package.json'
npm ERR! package.json npm can't find a package.json file in your current directory.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/divya/.npm/_logs/2017-09-12T03_05_20_995Z-debug.log
Message:
I ran the installation in the current working directory which has Package.json file but the error says the package.json doesn't exist. The path, it is showing is not right- "/Users/divya/Desktop/MFP/mdo-windows-support/package.json". It has to be "Users/divya/Desktop/MFP/nzrb-tab-mobilefirst/package.json". How do I change the path?
I am not sure what causing this issue. Much appreciated your help/suggestions.
IBM MobileFirst CLI is not supported in the npm version whatever you are trying with.
Try installing the same with npm version 3.10.10 and this should resolve the issue which you are facing.

Can't install any packages to NPM or BOWER

I have researched this extensively and nothing. So I am hoping this generates a different solution.
I keep getting this error
npm WARN packages#1.0.0 No description
npm WARN packages#1.0.0 No repository field.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "express"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! path C:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\.staging\depd-974ec5fe
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\.staging\depd-974ec5fe' -> 'C
:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\depd'
npm ERR! at destStatted (C:\Users\Luis\AppData\Roaming\nvm\v6.9.1\node_modules\npm\lib\install\action\finalize.js:25:7)
npm ERR! at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\.staging\depd-974ec5fe' -> 'C
:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\depd'
npm ERR! at Error (native)
npm ERR! { Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\.staging\depd-974ec5fe' ->
'C:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\depd'
npm ERR! at destStatted (C:\Users\Luis\AppData\Roaming\nvm\v6.9.1\node_modules\npm\lib\install\action\finalize.js:25:7)
npm ERR! at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\.staging\depd-974ec5fe' -> 'C
:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\depd'
npm ERR! at Error (native) parent: 'packages' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! C:\xampp\htdocs\nodeprojects\contact-list-app\npm-debug.log
It's not a Mac, It's a Windows machine, so nothing to do with sudo as other responses suggested here
I don't have an antivirus running so this was a no-go too
I ran npm cache clean as suggested here and other SO solutions
It was running fine, and then it started doing this when I tried to install angular-ui-bootstrap. but I was able to install other dependencies just fine.
I also did:
Restarted my machine
used CMD as administrator
Used git bash
Used npm console
Deleted the whole thing and started again in another directory ( got desperate)
uninstalled and re-installed node.js
drank a lot of coffee, and upgraded to alcohol
Please bail me out.
I am posting this answer, simply because there isn't enough documentation on this error in the web, but please if you have other ideas you'd like to add as a possible solution (other than the ones I tried in my question) please feel free. I'm sure there are a lot of other frustrated developers looking for this. Anyway, this is how I solved it.
I deleted my node_modules folder just so I can re-install the dependencies fresh. This doesn't break anything in your project because as soon as you add them back up, they will be in the exact same place they were before. So, do n't be afraid of the 404s you will get temporarily.
Then I did a fresh install by running
npm init
This get my packages.json file going
And then I tried to install my first dependency, any dependency, pick one. But the error came up and the node_modules didn't even get started. So I got it running by installing npm in itself as a dependency. Why did this work? Beats me! But the mystic powers of node know something I don't and I am ok with that.
So I did this basically
npm install npm --save
This built my node_modules folder and I was able to install everything back. I removed the npm dependency afterwards and it's like it was never there.
Again, feel free to post any other solutions. I don't think this is a definite solution so I won't mark it. It just worked for me. Thought I shared it
EDIT
DO NOT delete that npm dependency by running npm uninstall <package> as you normally would. Instead, just delete the dependency with a good 'ol delete key

NPM won't install pug?

Can anyone help me decipher what this message is about?
I have another app with pug installed, yet now I cannot create a new module installation for some reason.
I'm installing pug local to the app into node_modules
I'm just trying to get work done, so if I have missed something simple, my stress level has not been helpful with keeping precise vision.
My system is for ongoing development so I don't muck around with upgrades, which historically has broken all kinds of other stuff.
My other app works fine.
# npm install --save pug#2.0.0-beta4 <= Because the working app uses this one
npm ERR! Linux 3.2.0-35-generic-pae
npm ERR! argv "/home/kingram/.nvm/v0.10.46/bin/node" "/home/kingram/.nvm/v0.10.46/bin/npm" "install" "--save" "pug#2.0.0-beta4"
npm ERR! node v0.10.46
npm ERR! npm v2.15.1
npm ERR! path /home/kingram/.npm/wordwrap/0.0.2
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! Error: EACCES, mkdir '/home/kingram/.npm/wordwrap/0.0.2'
npm ERR! { [Error: EACCES, mkdir '/home/kingram/.npm/wordwrap/0.0.2']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/home/kingram/.npm/wordwrap/0.0.2',
npm ERR! parent: 'cliui' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /home/kingram/node/fssreg/npm-debug.log
You may need to install using sudo, ie - sudo npm install .... This will prompt you for your root password.
It looks like root privileges are required to install the package you're looking for. Though this shouldn't really be the case, you can fix this....check out this link
After some prodding by #zillaofthegods, it turns out some of directories in ~/.npm were owned by root. In particular the wordwrap module directory.
Changed the permissions and npm installed it fine.
One of those things I would not have caught without some prodding, so thanks.

Resources