How to start project node.js error with name - node.js

I need start the project https://github.com/oracle/bots-node-sdk and I don`t know a lot of node.js. I try follow the instructions, but I receive the errors.
npm install #oracle/bots-node-sdk
npm ERR! code ENOSELF
npm ERR! Refusing to install package with name "#oracle/bots-node-sdk" under a package
npm ERR! also called "#oracle/bots-node-sdk". Did you name your project the same
npm ERR! as the dependency you're installing?
npm ERR!
npm ERR! For more information, see:
npm ERR! <https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm>
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\josiv\AppData\Roaming\npm-cache\_logs\2019-02-05T16_16_57_042Z-debug.log
I already try change name in file package.json and also I try command: npm init "other_name" and always the same error.
Edit:
I change name in file package.json and run npm install #oracle/bots-node-sdk. After run npx #oracle/bots-node-sdk init with successful:
---------------------------------------------------------------------
Custom Component package 'bots-node-sdk-master' created successfully!
---------------------------------------------------------------------
Usage:
npm start Start a dev server with the component package
PS D:\Fontes\OracleDigitalAssistant-Bot\bots-node-sdk-master> npm start
> bots#2.1.3 start D:\Fontes\OracleDigitalAssistant-Bot\bots-node-sdk-master
> npm run bots-node-sdk -- --service .
> bots#2.1.3 bots-node-sdk D:\Fontes\OracleDigitalAssistant-Bot\bots-node-sdk-master
> bots-node-sdk "--service" "."

It is saying there's a conflict with your project name and the dependency you're trying to install.
In your package.json, if the name property is "#oracle/bots-node-sdk" then change it to someone else and then run npm install #oracle/bots-node-sdk again.
Alternatively you can just delete the package.json file and then run npm init -y.

Related

npm start command returns an error in the cmd

I want to start my React app, but when I run npm start, I get this error:
npm ERR! syscall open
npm ERR! path C:\Users\Muchendu\Documents\GitHub\Steve-React/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\Muchendu\Documents\GitHub\Steve-React\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\Muchendu\AppData\Local\npm-cache\_logs\2022-05-11T09_26_37_201Z-debug-0.log
This could be because right after running
npx create-react-app <your_app_name>
you are trying to run npm start
Instead try switching into your app directory like so:
cd <your_app_name>
because that is where your package.json will most likely exist and then try running
npm start
run this command in the terminal inside your project npm init -y.
This will generate a package.json in your project.
Otherwise since you are making a react app use the npx create-react-app your-app-name this will create all the necessary files for running you application.
What is package.json?
The package.json file is the heart of any Node project. It records important metadata about a project which is required before publishing to NPM, and also defines functional attributes of a project that npm uses to install dependencies, run scripts, and identify the entry point to our package.

Installing dependencies with npm-peer-dependencies

I am trying to install the required node_modules for a small project running Angular 11 using npm install
My goal is get the project to work locally after downloading it from GitHub. I have already installed the latest version of the Angular CLI.
After running the install command I tried npm start.
I was expecting that after running the install and start command to be able to run the project locally.
However the actual result I get after running the install command is the following list of errors:
> ng serve
An unhandled exception occurred: Cannot find module '#angular/compiler'
Require stack:
\node_modules\#angular\compiler-cli\index.js
\node_modules\#ngtools\webpack\src\angular_compiler_plugin.js
\node_modules\#ngtools\webpack\src\index.js
\node_modules\#angular-devkit\build-angular\src\webpack\configs\typescript.js
\node_modules\#angular-devkit\build-angular\src\webpack\configs\index.js
\node_modules\#angular-devkit\build-angular\src\browser\index.js
\node_modules\#angular-devkit\build-angular\src\dev-server\index.js
\node_modules\#angular-devkit\architect\node\node-modules-architect-host.js
\node_modules\#angular-devkit\architect\node\index.js
\node_modules\#angular\cli\models\architect-command.js
\node_modules\#angular\cli\commands\serve-impl.js
\node_modules\#angular-devkit\schematics\tools\export-ref.js
\node_modules\#angular-devkit\schematics\tools\index.js
\node_modules\#angular\cli\utilities\json-schema.js
\node_modules\#angular\cli\models\command-runner.js
\node_modules\#angular\cli\lib\cli\index.js
\node_modules\#angular\cli\lib\init.js
\node_modules\#angular\cli\bin\ng
See "angular-errors.log" for further details.
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file C:\WINDOWS\system32\cmd.exe
npm ERR! errno ENOENT
npm ERR! `ng serve`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the #0.0.16 start 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:
The problem is that this Angular project also has peer dependencies. I installed npm-install-peers package but it seems that simply running npm install afterwards will not install the required peer dependencies.
What should I do next to get this Angular project installed locally ?
The issue you are facing is likely because angular cli or npm-peer-dependencies are not installed globally on your machine.
The steps that you should take are to make sure of them are globally installed.
To install packages globally you need run npm install -g <package_name>
npm docs link
In your case for angular cli you should run
npm i -g #angular/cli#11.2.15 and npm install -g npm-peer-dependencies.
Then run npm start.

Cannot find module typescript.js after Windows restoration point. I'm triying to build my angular app

I had problems with my PC and I restored windows to and old restoration point.
After this... When I try to build my Angular App I have the next error:
C:\Udemy\AngularDeCeroAExpertoEdicion2021\03-paisesApp>npm run build
> paises-app#0.0.0 build C:\Udemy\AngularDeCeroAExpertoEdicion2021\03-paisesApp
> npm run config -- --environment=prod && ng build --prod
> paises-app#0.0.0 config C:\Udemy\AngularDeCeroAExpertoEdicion2021\03-paisesApp
> ts-node ./src/assets/scripts/setEnv.ts "--environment=prod"
internal/modules/cjs/loader.js:329
throw err;
^
Error: Cannot find module 'C:\Udemy\AngularDeCeroAExpertoEdicion2021\03-paisesApp\node_modules\typescript\lib\typescript.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:321:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:534:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:888:27)
at Function.resolve (internal/modules/cjs/helpers.js:98:19)
at loadCompiler (C:\Users\myuser\AppData\Roaming\npm\node_modules\ts-node\dist\index.js:208:34)
at create (C:\Users\myuser\AppData\Roaming\npm\node_modules\ts-node\dist\index.js:213:28)
at Object.register (C:\Users\myuser\AppData\Roaming\npm\node_modules\ts-node\dist\index.js:184:21)
at main (C:\Users\myuser\AppData\Roaming\npm\node_modules\ts-node\dist\bin.js:129:29)
at Object.<anonymous> (C:\Users\myuser\AppData\Roaming\npm\node_modules\ts-node\dist\bin.js:448:5)
at Module._compile (internal/modules/cjs/loader.js:1085:14) {
code: 'MODULE_NOT_FOUND',
path: 'C:\\Udemy\\AngularDeCeroAExpertoEdicion2021\\03-paisesApp\\node_modules\\typescript\\package.json',
requestPath: 'typescript'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! paises-app#0.0.0 config: `ts-node ./src/assets/scripts/setEnv.ts "--environment=prod"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the paises-app#0.0.0 config 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:\Users\myuser\AppData\Roaming\npm-cache\_logs\2021-08-01T08_27_09_159Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! paises-app#0.0.0 build: `npm run config -- --environment=prod && ng build --prod`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the paises-app#0.0.0 build 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:\Users\myuser\AppData\Roaming\npm-cache\_logs\2021-08-01T08_27_09_186Z-debug.log
I think that the problem is with the directory:
C:\Users\myuser\AppData\Roaming\npm\node_modules\
What can I do?
remove the folder node_modules?
reinstall npm?
I tried with npm install and all is ok.
Thanks.
Edited:
Maybe the problem was in my merged branches or something like that.
Since you have not specified what was the installed state of apps when the restoration point was lastly set, I presume that you have all the npm packages captured correctly at that point. If so, try doing the below steps...
Since you have not included the entire log with this, I can guess it is possibly an ambiguity issue due to references not properly resolved!
Open command prompt/powershell/terminal, etc. with admin privilege. Do as below (sudo command not to be used with Windows OS): -
sudo npm cache clean --force
sudo npm cache verify
Delete the package-lock.json file located at C:\Users\<your_username>
Try installing your project dependencies now from your project folder with npm i or yarn install (if you're using yarn as your preferred package manager).
Note: - If this doesn't work, follow the same process as above (again) and uninstall npm/yarn and node and reinstall it. It should work then!
I have fixed it by doing the following:
Remove the folder /node_modules of my Angular App.
Run npm install.
And then run npm run build or npm run start or ng serve.
I have also found a package that does the same. The package name is reinstall
reinstall
Reinstall package's node modules without cache.
Removes node_modules directory
Clean's NPM cache
Install's modules from package.json
npm install reinstall -g
Once installed remember restart your terminal and run reinstall in your root dir.
Maybe the problem was in my merged branches or something like that.

React native 'unable to find expo in the project

I am working for my study on a React Native project, with group members. My group member who made the project has no problems running the project. I have expo installed globally, but can not run the program:
Unable to find expo in this project - have you run yarn / npm install yet?
├─ action C:\Users\thoma\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:34:11
├─ C:\Users\thoma\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:135:22
└─ expo start C:\Users\thoma\AppData\Roaming\npm\node_modules\expo-cli\src\exp.ts:350:7
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # start: `expo start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\thoma\AppData\Roaming\npm-cache\_logs\2021-06-07T11_27_47_082Z-debug.log
What can I do to solve this?
At the root of your project, Run command
yarn
So basically your partner would have added few dependencies and committed his code. Now after fetching you need to have those dependencies in your project which is why you would have to run above command.
You can also use npm install, depending upon your system configurations.
This is because you are not in your project folder.
You need to run this command:
expo start
inside the project folder.

Cypress installation failed

I installed nodejs and npm on windows 10. Than I tried to install cypress via npm install cypress --save-dev and get the following Error:
> node index.js --exec install
The command "node" is either misspelled or
could not be found.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cypress#3.8.2 postinstall: `node index.js --exec install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cypress#3.8.2 postinstall 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:\Users\U\AppData\Roaming\npm-cache\_logs\2020-01-21T11_05_01_566Z-debug.log
After this I added the path %USERPROFILE%\AppData\Local\Temp to my system environment variables. But I get this error messages again. How can I fix this problem?
try the following steps :
install git on your machine and config it as global.
delete old package.js then re-init new package.
try again cypress install command
Try this instead by installing the previous version but Explicitly: npm install cypress#8.1.0 --save-dev
Download it in the any directory its a hack to download, if your proxy is properly configured and internet speed is good. it will download while doing npm install
wget https://cdn.cypress.io/desktop/7.6.0/win32-x64/cypress.zip
Provide the zip location
CYPRESS_INSTALL_BINARY=~/Downloads/cypress.zip npm install cypress
Remember to actually run the npm command inside your folder with the package.json.
Delete the package.json.
Again re build the package by npm init.
Install Cypress again by using npm install cypress --save-dev.

Resources