How can I install Foundation for Sites correctly with npm? - npm

I would like to create a template based on the Foundation Zurb template which can be updated easily. So my first thought was to use npm to get the package and specific versions.
The "Foundation for Sites" documentation says that Foundation can be installed with the command:
npm install foundation-sites.
If I call this command in an empty directory I get the following output:
npm WARN saveError ENOENT: no such file or directory, open '/home/robert/Documents/blog/src/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/home/robert/Documents/blog/src/package.json'
npm WARN src No description
npm WARN src No repository field.
npm WARN src No README data
npm WARN src No license field.
+ foundation-sites#6.4.3
Afterwards I see the following files/directories:
node_modules/
package-lock.json
From the documentation I would have expected this:
It occurs to me that I'm missing some understanding.
Is that a reasonable way to "build" the package?

npm installs dependencies into node_modules.
You want to use one of the templates eg https://github.com/zurb/foundation-zurb-template or https://github.com/zurb/foundation-sites-template which you can install using foundation-cli.

Related

What is the reason for the npm installation error ENOENT: no such file or directory, open 'C:\Users\tusha\package.json'?

I try to install libraries with npm on Windows to work with JavaScript, but it shows this error output in Windows command prompt window:
C:\Users\tusha>npm install
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\tusha/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\tusha\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\tusha\AppData\Local\npm-cache\_logs\2022-04-24T10_37_38_185Z-debug-0.log
C:\Users\tusha>
Here is also a photo:
Screen shot of command prompt window with the error output
The log of the failed installation process:
The complete log file on Google Drive
ERR telling that in your folder directory you are installing some packages through npm. Look like package.json not found in located directory
Before run npm install to empty folder you have to initialize the npm init to create package.json file. and start installing packages.
npm install reads the file package.json from the current directory and installs all the packages it depends on. The error message says that there is no such file.
You need to cd to the directory the Node.js project (e.g. something you might have checked out from a Git repository) and run npm install there.
Alternatively, if you are trying to install a specific package from the npm repository then you need to:
cd to the directory containing the package you want to add it as a dependency of
run npm install name-of-package
If you don't have a project yet, and want to create one, then:
cd to the directory you want to create your package inside
npm init and follow the prompts
Alternatively, if you are trying to install a program from npm globally then reconsider as current best practice is to run program with npx and not install them as globals. Use the name of the package you want to run as an argument.
npx create-react-app
If you really want to install globally, then use the -g switch and the name of the package.
npm install -g create-react-app

NPM install not work and make lock-json file

Hi I'm trying to install npm to run a kit.
my node version is: v12.18.3
my npm version is: 6.14.6
my folder is "test" and I'm installing npm with this command:
Kian#DESKTOP-CL16DA7 MINGW64 /d/markitdone/test
$ npm install
npm WARN saveError ENOENT: no such file or directory, open 'D:\markitdone\test\package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'D:\markitdone\test\package.json'
npm WARN test No description
npm WARN test No repository field.
npm WARN test No README data
npm WARN test No license field.
up to date in 0.845s
found 0 vulnerabilities
Could someone help me please?
Before you use npm install.
You need to create a project, either React, Vue.js or Angular in your test directory

NPM install only creating a package-lock.json?

I am working on a Microsoft Surface 3 running Windows 10. I use git bash for windows for file system management. I'm running npm version 6.14.4 and node version 12.16.2
I'm currently working on an app for some school work and want to run a lite-server instead of vscode's go live extension.
My understanding is that npm install should be run outside of the application as a best practice, but once it's running, you can go back in your terminal in vscode and use npm run start or npm run dev to get the server up. I learned that the two-step process from an online course where I cloned the instructor's work from his Github. In other words, he may have done some preliminary steps that I'm leaving out unintentionally.
I visited the npm docs and spend about an hour familiarizing myself with the technology. Found a nice, simple set of commands to get moving:
$ npm install lite-server --save-dev
(which I run in the project's root folder from git bash)
$ yarn add lite-server --dev # or yarn
...and add a "script" entry within your project's package.json file:
Inside package.json...
"scripts": {
"dev": "lite-server"
},
With the above script entry, you can then start lite-server via:
$ npm run dev
Problem is, I get loads of errors upon NPM install, no package.json file is generated (only a package-lock.json), and attempting npm run dev brings up multiple errors.
From NPM install, I see the following issues mostly:
I get deprecated warnings, chokidar, fsevents, urix, etc.
npm WARN deprecated chokidar#2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents#1.2.12: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
I am always getting this package-lock.json notice, not sure what it is:
npm notice created a lockfile as package-lock.json. You should commit this file.
Obviously loads of "skipping optional dependency" warnings:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.7 (node_modules\chokidar\node_modules\fsevents):
I get "no such file or directory" warnings:
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\smansfield\desktop\bootcamp_code_responses\class_content_1\activity_4\package.json'
I get these warnings:
npm WARN activity_4 No description
npm WARN activity_4 No repository field.
npm WARN activity_4 No README data
npm WARN activity_4 No license field.
From npm run dev I'm getting these errors:
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\smansfield\Desktop\bootcamp_code_responses\class_content_1\activity_4\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\smansfield\Desktop\bootcamp_code_responses\class_content_1\activity_4\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\smansfield\AppData\Roaming\npm-cache_logs\2020-04-26T17_59_00_317Z-debug.log
I've searched all manner of blogs for any insight on these items... No one seems to have posted about these exact items:
why NPM install is responding with so many errors, deprecation, etc.
why am I only getting package-lock.json upon install?
why am I always getting these errors when I try to spin up the lite-server, especially these ENOENT codes and path errors?
Thank you for any insight you can provide me on this. I'll most certainly pay it forward.
Sam
Try run npm init first. It will initialize your project with npm.

Magento 2 Grunt - package.json and grunt file

I had problem with Grunt installation with Magento 2.
Below are the two issues:
After running npm install in magento 2 directory
npm install
npm WARN saveError ENOENT: no such file or directory, open '/var/www/html/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/var/www/html/package.json'
npm WARN html No description
npm WARN html No repository field.
npm WARN html No README data
npm WARN html No license field.
up to date in 0.089s
Checking grunt - grunt clean:blank
grunt clean:blank
A valid Gruntfile could not be found. Please see the getting started guide for more information on how to configure grunt: http://gruntjs.com/getting-started
After reading a few tutorials I missed these things:
Rename these three files in your magento 2 root directory
package.json.sample => package.json
grunt.js.sample => grunt.js
grunt-config.js.sample => grunt-config.js
I hope this help someone and save time.

Can't uninstall a package

I'm getting this error text when attempting to uninstall tfx-cli:
C:\Users\Admin>npm uninstall tfx-cli
npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\Admin\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Admin\package.json'
npm WARN Admin No description
npm WARN Admin No repository field.
npm WARN Admin No README data
npm WARN Admin No license field.
up to date in 0.14s
I'm trying to uninstall due to this issue, so I can attempt another reinstall.
The file C:\Users\Admin\package.json doesn't exist, but C:\Users\Admin\package-lock.json does. It contains a single line of text:
{
"lockfileVersion": 1
}
How to get past this?
npm by default looks for the package in local folder. You need to use -g option if you want to install/uninstall globally.
npm uninstall -g tfx-cli