ENOENT error when doing ionic start - ionic2

I upgraded to beta.23 and started to get an error when created a new project using 'ionic start foo --v2 --verbose'.
The error in red says
"Unable to spawn commandError: spawn npm ENOENT (CLI v2.0.0-beta.23)."
I have npm installed and can run from Windows 8 cmd line.
I tried upgrade to node v5.9.1.
I confirmed npm is in the PATH environment variable and can run npm from cmd shell.
Any ideas how to fix or debug further would be appreciated.
Here is the complete output:
C:\ionic2>ionic start foo --v2 --verbose
Task setting: title=start, name=start, summary=Starts a new Ionic project in the
specified PATH, [options]=any flags for the command, <PATH>=directory for the n
ew project, [template]=Starter templates can either come from a named template,
(ex: tabs, sidemenu, blank),
a Github repo, a Codepen url, or a local directory.
Codepen url,
Defaults to Ionic "tabs" starter template, --appname|-a=Human readable name for
the app (Use quotes around the name), --id|-i=Package name for <widget id> confi
g, ex: com.mycompany.myapp, title=Skip npm package installation, boolean=true, t
itle=Create a basic structure without Cordova requirements, boolean=true, title=
Setup the project to use Sass CSS precompiling, boolean=true, title=List starter
templates available, boolean=true, --io-app-id=The Ionic.io app ID to use, --te
mplate|-t=Project starter template, boolean=true, title=Start a Ionic v2 project
, boolean=true, title=(with --v2 only) Use TypeScript in starter, --zip-file|-z=
URL to download zipfile for starter template, module=./ionic/start, disableChang
ePwd=true
Utils.preprocessCliOptions _=[start, foo], skip-npm=false, no-cordova=false, w=f
alse, sass=false, s=false, list=false, l=false, v2=true, v=false, typescript=fal
se, -ts=false, verbose=true, $0=C:\Program Files\nodejs\node.exe C:\Users\bradtk
e\AppData\Roaming\npm\node_modules\ionic\bin\ionic
One awesome Ionic app coming right up...
Creating Ionic app in folder C:\ionic2\foo based on tabs project
Downloading: https://github.com/driftyco/ionic2-app-base/archive/master.zip
[=============================] 100% 0.0s
Downloading: https://github.com/driftyco/ionic2-starter-
tabs/archive/master.zip
[=============================] 100% 0.0s
Installing npm packages...
Running exec command: npminstall
Utils.fail Unable to run spawn commandError: spawn npm ENOENT undefined
Utils.fail stack undefined
Utils.errorHandler is set, calling that now
Cli.Utils.errorHandler msg Unable to run spawn commandError: spawn npm ENOENT st
ring
Unable to run spawn commandError: spawn npm ENOENT (CLI v2.0.0-beta.23)
Your system information:
Cordova CLI: 6.1.0 (cordova-lib#undefined)
Ionic CLI Version: 2.0.0-beta.23
Ionic App Lib Version: 2.0.0-beta.13
OS: Windows 8.1
Node Version: v5.9.1
Regards,
bruce

I have the exact same issue. Worked in beta 22.
Reverting to the earlier beta resolved the issue:
npm install -g ionic#2.0.0-beta.22

Move into folder of your application and run npm install. I don't know what is happening but sound like start script trying to execute npminstall rather than npm install:
Installing npm packages...
Running exec command: npminstall

This is a known issue with the CLI on windows. Downgrading to cli beta22 can work as workaround for now, but this will be fixed in the next release

Upgrading npm worked for me.
npm install -g npm

Related

Expo won't build with locally installed NPM packages

I am using expo#43.0.3 (and expo-cli#5.0.3) to manage my react native project and I have to install an npm package from local source:
$ npm install /path/to/mypackage
In my package.json the package is successfully linked via
"dependencies": {
...
"myPackage": "file:../../mypackage",
...
}
I can also confirm the package works when installing to a new plain node project (same node version 14.8.2)
Now when I start expo via expo start and navigate to the app it does not throw any error but only a warning:
› Reloading apps
warn No apps connected. Sending "reload" to all React Native apps failed. Make sure your app is running in the simulator or on a phone connected via USB.
When using the package from registry everything builds, however.
I tried to use the private packages section form the expo docs, but they only describe how to use private packages from registry but not local.
Anything I'm missing here?
edit:
After resetting the expo network adapters it loads the bundle but it now says it can't find the package:
Unable to resolve module myPackage from /home/user/path/to/myPackage/file.js: myPackage could not be found within the project or in these directories:
node_modules
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
However, I'm not using watchman and I'm not using yarn and rmoving metro- folders from /tmp did not make a difference.
As it turned out in this issue on GitHub it can be solved via npm pack:
run npm pack inside of your library and then npm install path/to/the/packed/file.tgz from your project
Which worked fine for the setup I described in the question.

getting error whenever try to deploy backend with cdk via gitlab , in local it will works as expected

I am trying to deploy backend serverless resources with CDK in AWS cloud but getting errors while deploying things via GitLab build.
trying with a local visual studio it works fine.
error is below :
$ npm run deploy-backend
> ui-dashboard-infra#0.0.0 deploy-backend /builds/project/control-panel/infra
> cdk deploy --app 'ts-node stacks/backend' --all --require-approval never
Bundling asset dashboard-A/restFunctionFallbackus-east-1/Code/Stage...
/builds/project/control-panel/infra/node_modules/#aws-cdk/core/lib/asset-staging.ts:398
throw new Error(`Failed to bundle asset ${this.node.path}, bundle output is located at ${bundleErrorDir}: ${err}`);
^
Error: Failed to bundle asset dashboard-A/restFunctionFallbackus-east-1/Code/Stage, bundle output is located at /builds/project/control-panel/infra/cdk.out/bundling-temp-4607286efdd890681baca6f8a5d9b9b32929fa84e9947500fbe203e5b5d06a0f-error: Error: spawnSync bash ENOENT
at AssetStaging.bundle (/builds/project/control-panel/infra/node_modules/#aws-cdk/core/lib/asset-staging.ts:398:13)
at AssetStaging.stageByBundling (/builds/project/control-panel/infra/node_modules/#aws-cdk/core/lib/asset-staging.ts:246:10)
at stageThisAsset (/builds/project/control-panel/infra/node_modules/#aws-cdk/core/lib/asset-staging.ts:137:35)
at Cache.obtain (/builds/project/control-panel/infra/node_modules/#aws-cdk/core/lib/private/cache.ts:24:13)
at new AssetStaging (/builds/project/control-panel/infra/node_modules/#aws-cdk/core/lib/asset-staging.ts:162:44)
at new Asset (/builds/project/control-panel/infra/node_modules/#aws-cdk/aws-s3-assets/lib/asset.ts:68:21)
at AssetCode.bind (/builds/project/control-panel/infra/node_modules/#aws-cdk/aws-lambda/lib/code.ts:180:20)
Subprocess exited with error 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ui-dashboard-infra#0.0.0 deploy-backend: `cdk deploy --app 'ts-node stacks/backend' --all --require-approval never`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ui-dashboard-infra#0.0.0 deploy-backend 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! /root/.npm/_logs/2021-08-10T08_29_17_449Z-debug.log
I have faced a similar kind of issue, and the problem is that there is a bug in cdk versions prior to the once released before 25th Feb 2021.
For that, please make sure either you are using the latest version of cdk, or you DO NOT HAVE ANY WHITE SPACES IN YOUR FILE PATHNAME (any directory name having space or your username that has a space might cause this problem). Once I removed the white spaces from the pathname, everything started to work as expected.
I got the same error as you. In my case, the issue was that I had esbuild installed as a dependency in the CDK folder, but not in the folder of my Lambda function.
I was able to fix the issue by installing esbuild as a dev dependency in my Lambda function folder. If you don't want to do that, you can also install it globally in your pipeline by adding the command npm i -g esbuild to your pipeline (consider pinning it to a particular version ie. npm i -g esbuild#x.y.z).
No idea why it was working locally without esbuild installed in the function folder, but then broke when doing the same thing in a Gitlab pipeline… I didn't have esbuild installed globally on my local machine or anything.

VSTS Bower not found

We are using Visual Studio Team Services for build and deployment of several sites. Some .NET and some are not. All working fine when using the hosted agent. Due to performance issues and long queue times for the hosted agent we need to use our own build agent.
Here comes the problem:
When running the VSTS builds we get an error when running bower:
******************************************************************************
Starting: bower install
******************************************************************************
C:\Program Files (x86)\nodejs\npm.cmd install -g bower
C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\npm\bower -> C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\npm\node_modules\bower\bin\bower
bower#1.7.9 C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\npm\node_modules\bower
Not found bower: null
******************************************************************************
Finishing: bower install
******************************************************************************
The problem is that bower is actually in that location:
And here are the actual bower build step:
How can we fix this Not found bower: null error?
There are known issues with tools installed into profile folders it has to do with permissions. It's easier to install the tool from an administrative console with the -g parameter. And ensure that the central NPM version is added to the service or system's %path% environment variable.
Or pass in a specific location by adding additional parameters to the call to npm: npm install --prefix "$(Agent.WorkFolder)" Bower Then specify the same location in the Advanced section of the Bower task.
Bower CLI location: $(Agent.WorkFolder)\node_modules\
(You'd need to check the exact location the package is installed to, I'm slightly guessing at the moment ;)).

Using Gulp with Visual Studio Team Services

I'm looking to set up automated builds with Visual Studio Team Services but I keep running into trouble. My build definition:
npm install gulp
npm install --save-dev jshint gulp-jshint ruby
npm install gulp-ruby-sass gulp-autoprefixer gulp-cssnano gulp-concat gulp-uglify gulp-imagemin gulp-notify gulp-rename gulp-livereload gulp-cache del --save-dev
gem install sass
gulp
The build fails when attempting to install the sass gem with "'gem' is not recognized as an internal or external command". If I build without installing the sass gem first, gulp will fail with "'sass' is not recognized as an internal or external command". Anyone have experience with getting sass to work in Visual Studio Team Services?
There seem to be several issue here. First you might need to make you familiar how npm works, whats the meaning of --save-dev and whats the difference between local and globally installed modules.
--save-dev is used to save the package for development purpose, while --save is used to save the package required for the application to run. Both are commands which you run on your development machine and you put the resulting package.json under version control.
On the build server you will just run an npm install which will restore all the packages listed in the package.json.
These is for local modules. You can also install modules globally using the -g flag. This will store them outside of your current project, and binaries will be available in your PATH variable. Modules which you need inside your project (using require) need to be installed locally. Modules you'll call from the shell (eg gulp-cli) need to be installed globally.
Therefore what you need to do:
On your development machine add all local npm modules using npm install with either the --save or --save-dev flag.
Put the resulting package.json file under version control.
On the build server you need to make sure that all required global npm modules are installed.
Call npm install using the VSTS npm task to restore the local npm modules. You won't need to specify which modules need to be installed, since they're already listed in the package.json file.
Call gulp using the VSTS gulp task with the appropriate arguments.

Ember Cli on windows

I m trying to get Ember cli on Windows 7.I have installed node and npm.
But when I type npm install -g ember-cli I get the following error.Is there anything that I am missing?
Try running:
npm package.json
to see errors in the package.json file. Otherwise try:
npm cache clean